add ocis-pkg/config default config + fix logging inheritance

This commit is contained in:
A.Unger
2021-11-08 11:14:26 +01:00
parent 835928b29b
commit 74dae6dad9
11 changed files with 152 additions and 249 deletions

View File

@@ -5,10 +5,8 @@ package command
import (
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/owncloud/ocis/proxy/pkg/command"
svcconfig "github.com/owncloud/ocis/proxy/pkg/config"
"github.com/urfave/cli/v2"
)
@@ -25,33 +23,12 @@ func ProxyCommand(cfg *config.Config) *cli.Command {
return ParseConfig(ctx, cfg)
},
Action: func(c *cli.Context) error {
origCmd := command.Server(configureProxy(cfg))
origCmd := command.Server(cfg.Proxy)
return handleOriginalAction(c, origCmd)
},
}
}
func configureProxy(cfg *config.Config) *svcconfig.Config {
cfg.Proxy.OcisURL = cfg.OcisURL
cfg.Proxy.Log.Level = cfg.Log.Level
cfg.Proxy.Log.Pretty = cfg.Log.Pretty
cfg.Proxy.Log.Color = cfg.Log.Color
cfg.Proxy.Service.Version = version.String
if cfg.Tracing.Enabled {
cfg.Proxy.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Proxy.Tracing.Type = cfg.Tracing.Type
cfg.Proxy.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Proxy.Tracing.Collector = cfg.Tracing.Collector
}
if cfg.TokenManager.JWTSecret != "" {
cfg.Proxy.TokenManager.JWTSecret = cfg.TokenManager.JWTSecret
}
return cfg.Proxy
}
func init() {
register.AddCommand(ProxyCommand)
}