fixed panic in ocs service by configuring grpc
Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
Enhancement: Configure GRPC in ocs
|
||||||
|
|
||||||
|
Fixes a panic in ocs when running not in single binary
|
||||||
|
|
||||||
|
https://github.com/owncloud/ocis/pull/6022
|
||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/owncloud/ocis/v2/services/ocs/pkg/tracing"
|
"github.com/owncloud/ocis/v2/services/ocs/pkg/tracing"
|
||||||
|
|
||||||
"github.com/oklog/run"
|
"github.com/oklog/run"
|
||||||
|
ogrpc "github.com/owncloud/ocis/v2/ocis-pkg/service/grpc"
|
||||||
"github.com/owncloud/ocis/v2/services/ocs/pkg/config"
|
"github.com/owncloud/ocis/v2/services/ocs/pkg/config"
|
||||||
"github.com/owncloud/ocis/v2/services/ocs/pkg/metrics"
|
"github.com/owncloud/ocis/v2/services/ocs/pkg/metrics"
|
||||||
"github.com/owncloud/ocis/v2/services/ocs/pkg/server/debug"
|
"github.com/owncloud/ocis/v2/services/ocs/pkg/server/debug"
|
||||||
@@ -34,6 +35,11 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = ogrpc.Configure(ogrpc.GetClientOptions(cfg.GRPCClientTLS)...)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
gr = run.Group{}
|
gr = run.Group{}
|
||||||
ctx, cancel = func() (context.Context, context.CancelFunc) {
|
ctx, cancel = func() (context.Context, context.CancelFunc) {
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ type Config struct {
|
|||||||
|
|
||||||
HTTP HTTP `yaml:"http"`
|
HTTP HTTP `yaml:"http"`
|
||||||
|
|
||||||
|
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
|
||||||
|
|
||||||
TokenManager *TokenManager `yaml:"token_manager"`
|
TokenManager *TokenManager `yaml:"token_manager"`
|
||||||
|
|
||||||
Context context.Context `yaml:"-"`
|
Context context.Context `yaml:"-"`
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package defaults
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/owncloud/ocis/v2/ocis-pkg/structs"
|
||||||
"github.com/owncloud/ocis/v2/services/ocs/pkg/config"
|
"github.com/owncloud/ocis/v2/services/ocs/pkg/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -86,6 +87,10 @@ func EnsureDefaults(cfg *config.Config) {
|
|||||||
if cfg.Commons != nil {
|
if cfg.Commons != nil {
|
||||||
cfg.HTTP.TLS = cfg.Commons.HTTPServiceTLS
|
cfg.HTTP.TLS = cfg.Commons.HTTPServiceTLS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg.GRPCClientTLS == nil && cfg.Commons != nil {
|
||||||
|
cfg.GRPCClientTLS = structs.CopyOrZeroValue(cfg.Commons.GRPCClientTLS)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sanitize sanitizes the configuration
|
// Sanitize sanitizes the configuration
|
||||||
|
|||||||
Reference in New Issue
Block a user