mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-31 17:30:29 -06:00
Merge pull request #6022 from kobergj/ConfigureGRPCInOCS
Fix Panic in OCS service
This commit is contained in:
5
changelog/unreleased/configure-grpc-in-ocs.md
Normal file
5
changelog/unreleased/configure-grpc-in-ocs.md
Normal file
@@ -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/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/metrics"
|
||||
"github.com/owncloud/ocis/v2/services/ocs/pkg/server/debug"
|
||||
@@ -34,6 +35,11 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
err = ogrpc.Configure(ogrpc.GetClientOptions(cfg.GRPCClientTLS)...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var (
|
||||
gr = run.Group{}
|
||||
ctx, cancel = func() (context.Context, context.CancelFunc) {
|
||||
|
||||
@@ -19,6 +19,8 @@ type Config struct {
|
||||
|
||||
HTTP HTTP `yaml:"http"`
|
||||
|
||||
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
|
||||
|
||||
TokenManager *TokenManager `yaml:"token_manager"`
|
||||
|
||||
Context context.Context `yaml:"-"`
|
||||
|
||||
@@ -3,6 +3,7 @@ package defaults
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/structs"
|
||||
"github.com/owncloud/ocis/v2/services/ocs/pkg/config"
|
||||
)
|
||||
|
||||
@@ -86,6 +87,10 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
if cfg.Commons != nil {
|
||||
cfg.HTTP.TLS = cfg.Commons.HTTPServiceTLS
|
||||
}
|
||||
|
||||
if cfg.GRPCClientTLS == nil && cfg.Commons != nil {
|
||||
cfg.GRPCClientTLS = structs.CopyOrZeroValue(cfg.Commons.GRPCClientTLS)
|
||||
}
|
||||
}
|
||||
|
||||
// Sanitize sanitizes the configuration
|
||||
|
||||
Reference in New Issue
Block a user