fix inheritance config on accounts command
This commit is contained in:
@@ -6,15 +6,12 @@ package command
|
||||
import (
|
||||
"github.com/owncloud/ocis/accounts/pkg/command"
|
||||
"github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
"github.com/owncloud/ocis/ocis/pkg/register"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
// AccountsCommand is the entrypoint for the accounts command.
|
||||
func AccountsCommand(cfg *config.Config) *cli.Command {
|
||||
var globalLog shared.Log
|
||||
|
||||
return &cli.Command{
|
||||
Name: "accounts",
|
||||
Usage: "Start accounts server",
|
||||
@@ -32,16 +29,13 @@ func AccountsCommand(cfg *config.Config) *cli.Command {
|
||||
return err
|
||||
}
|
||||
|
||||
globalLog = cfg.Log
|
||||
if cfg.Commons != nil {
|
||||
cfg.Accounts.Commons = cfg.Commons
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
// if accounts logging is empty in ocis.yaml
|
||||
if (cfg.Accounts.Log == shared.Log{}) && (globalLog != shared.Log{}) {
|
||||
// we can safely inherit the global logging values.
|
||||
cfg.Accounts.Log = globalLog
|
||||
}
|
||||
origCmd := command.Server(cfg.Accounts)
|
||||
return handleOriginalAction(c, origCmd)
|
||||
},
|
||||
|
||||
@@ -4,8 +4,6 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/shared"
|
||||
|
||||
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/ocis-pkg/version"
|
||||
@@ -86,9 +84,6 @@ type SutureService struct {
|
||||
|
||||
// NewSutureService creates a new store.SutureService
|
||||
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
||||
if (cfg.Accounts.Log == shared.Log{}) {
|
||||
cfg.Accounts.Log = cfg.Log
|
||||
}
|
||||
return SutureService{
|
||||
cfg: cfg.Store,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user