mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-06 12:19:37 -06:00
reduce duplication in configuration code
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/config/defaults"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/structs"
|
||||
"github.com/owncloud/ocis/v2/services/settings/pkg/config"
|
||||
rdefaults "github.com/owncloud/ocis/v2/services/settings/pkg/store/defaults"
|
||||
"github.com/pkg/errors"
|
||||
@@ -104,20 +104,11 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
cfg.AdminUserID = cfg.Commons.AdminUserID
|
||||
}
|
||||
|
||||
if cfg.GRPCClientTLS == nil {
|
||||
cfg.GRPCClientTLS = &shared.GRPCClientTLS{}
|
||||
if cfg.Commons != nil && cfg.Commons.GRPCClientTLS != nil {
|
||||
cfg.GRPCClientTLS.Mode = cfg.Commons.GRPCClientTLS.Mode
|
||||
cfg.GRPCClientTLS.CACert = cfg.Commons.GRPCClientTLS.CACert
|
||||
}
|
||||
if cfg.GRPCClientTLS == nil && cfg.Commons != nil {
|
||||
cfg.GRPCClientTLS = structs.CopyOrZeroValue(cfg.Commons.GRPCClientTLS)
|
||||
}
|
||||
if cfg.GRPC.TLS == nil {
|
||||
cfg.GRPC.TLS = &shared.GRPCServiceTLS{}
|
||||
if cfg.Commons != nil && cfg.Commons.GRPCServiceTLS != nil {
|
||||
cfg.GRPC.TLS.Enabled = cfg.Commons.GRPCServiceTLS.Enabled
|
||||
cfg.GRPC.TLS.Cert = cfg.Commons.GRPCServiceTLS.Cert
|
||||
cfg.GRPC.TLS.Key = cfg.Commons.GRPCServiceTLS.Key
|
||||
}
|
||||
if cfg.GRPC.TLS == nil && cfg.Commons != nil {
|
||||
cfg.GRPC.TLS = structs.CopyOrZeroValue(cfg.Commons.GRPCServiceTLS)
|
||||
}
|
||||
|
||||
if cfg.Commons != nil {
|
||||
|
||||
Reference in New Issue
Block a user