diff --git a/ocis-pkg/config/config.go b/ocis-pkg/config/config.go index 1b8f7e9634..0f1edfb95d 100644 --- a/ocis-pkg/config/config.go +++ b/ocis-pkg/config/config.go @@ -22,14 +22,6 @@ import ( webdav "github.com/owncloud/ocis/webdav/pkg/config" ) -// Log defines the available logging configuration. -type Log struct { - Level string `mapstructure:"level"` - Pretty bool `mapstructure:"pretty"` - Color bool `mapstructure:"color"` - File string `mapstructure:"file"` -} - // Debug defines the available debug configuration. type Debug struct { Addr string `mapstructure:"addr"` @@ -87,7 +79,7 @@ type Config struct { OcisURL string `mapstructure:"ocis_url"` Registry string `mapstructure:"registry"` - Log Log `mapstructure:"log"` + Log shared.Log `mapstructure:"log"` Debug Debug `mapstructure:"debug"` HTTP HTTP `mapstructure:"http"` GRPC GRPC `mapstructure:"grpc"` @@ -131,7 +123,7 @@ func New() *Config { func DefaultConfig() *Config { return &Config{ - Log: Log{ + Log: shared.Log{ Level: "info", }, Debug: Debug{ diff --git a/ocis-pkg/shared/shared_types.go b/ocis-pkg/shared/shared_types.go index 4897dc3cb0..9a938d5533 100644 --- a/ocis-pkg/shared/shared_types.go +++ b/ocis-pkg/shared/shared_types.go @@ -7,3 +7,11 @@ type EnvBinding struct { EnvVars []string // name of the environment var. Destination interface{} // pointer to the original config value to modify. } + +// Log defines the available logging configuration. +type Log struct { + Level string `mapstructure:"level"` + Pretty bool `mapstructure:"pretty"` + Color bool `mapstructure:"color"` + File string `mapstructure:"file"` +} diff --git a/ocis/pkg/command/proxy.go b/ocis/pkg/command/proxy.go index df4e865629..3b768a201d 100644 --- a/ocis/pkg/command/proxy.go +++ b/ocis/pkg/command/proxy.go @@ -23,6 +23,7 @@ func ProxyCommand(cfg *config.Config) *cli.Command { return ParseConfig(ctx, cfg) }, Action: func(c *cli.Context) error { + cfg.Proxy.Log = cfg.Log origCmd := command.Server(cfg.Proxy) return handleOriginalAction(c, origCmd) }, diff --git a/proxy/pkg/command/root.go b/proxy/pkg/command/root.go index 64ecbe874d..cc1f91fe1e 100644 --- a/proxy/pkg/command/root.go +++ b/proxy/pkg/command/root.go @@ -88,6 +88,7 @@ type SutureService struct { // NewSutureService creates a new proxy.SutureService func NewSutureService(cfg *ociscfg.Config) suture.Service { + cfg.Proxy.Log = cfg.Log return SutureService{ cfg: cfg.Proxy, } diff --git a/proxy/pkg/config/config.go b/proxy/pkg/config/config.go index f2c16df67b..fec1e7449f 100644 --- a/proxy/pkg/config/config.go +++ b/proxy/pkg/config/config.go @@ -5,6 +5,7 @@ import ( "path" "github.com/owncloud/ocis/ocis-pkg/config/defaults" + "github.com/owncloud/ocis/ocis-pkg/shared" ) // Log defines the available logging configuration. @@ -108,7 +109,7 @@ type Config struct { OcisURL string File string `mapstructure:"file"` - Log Log `mapstructure:"log"` + Log shared.Log `mapstructure:"log"` Debug Debug `mapstructure:"debug"` HTTP HTTP `mapstructure:"http"` Service Service `mapstructure:"service"` @@ -203,7 +204,7 @@ func New() *Config { func DefaultConfig() *Config { return &Config{ File: "", - Log: Log{}, // logging config is inherited. + Log: shared.Log{}, // logging config is inherited. Debug: Debug{ Addr: "0.0.0.0:9205", Token: "",