From 872cd807e710af4b8fe09af861aef4674a312614 Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Wed, 17 Nov 2021 17:07:25 +0100 Subject: [PATCH] Revert "remove dead code from store regarding common propagation" This reverts commit 1d127c8ab21ad50e35aea2cea87008b1a47a3df1. --- store/pkg/command/server.go | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/store/pkg/command/server.go b/store/pkg/command/server.go index a8677eb16..622719874 100644 --- a/store/pkg/command/server.go +++ b/store/pkg/command/server.go @@ -3,6 +3,10 @@ package command import ( "context" + gofig "github.com/gookit/config/v2" + ociscfg "github.com/owncloud/ocis/ocis-pkg/config" + "github.com/owncloud/ocis/ocis-pkg/shared" + "github.com/owncloud/ocis/store/pkg/tracing" "github.com/owncloud/ocis/ocis-pkg/sync" @@ -21,7 +25,26 @@ func Server(cfg *config.Config) *cli.Command { Name: "server", Usage: "Start integrated server", Before: func(ctx *cli.Context) error { - return ParseConfig(ctx, cfg) + // remember shared logging info to prevent empty overwrites + inLog := cfg.Log + if err := ParseConfig(ctx, cfg); err != nil { + return err + } + + if (cfg.Log == shared.Log{}) && (inLog != shared.Log{}) { + // set the default to the parent config + cfg.Log = inLog + + // and parse the environment + conf := &gofig.Config{} + conf.LoadOSEnv(config.GetEnv(), false) + bindings := config.StructMappings(cfg) + if err := ociscfg.BindEnv(conf, bindings); err != nil { + return err + } + } + + return nil }, Action: func(c *cli.Context) error { logger := NewLogger(cfg)