diff --git a/pkg/command/graph-explorer.go b/pkg/command/graph-explorer.go index c25ea10d0..f8e50422b 100644 --- a/pkg/command/graph-explorer.go +++ b/pkg/command/graph-explorer.go @@ -18,13 +18,14 @@ func GraphExplorerCommand(cfg *config.Config) *cli.Command { Usage: "Start graph explorer", Category: "Extensions", Flags: flagset.ServerWithConfig(cfg.GraphExplorer), - Action: func(c *cli.Context) error { - scfg := configureGraphExplorer(cfg) + Action: func(ctx *cli.Context) error { + graphExplorerCommand := command.Server(configureGraphExplorer(cfg)) - return cli.HandleAction( - command.Server(scfg).Action, - c, - ) + if err := graphExplorerCommand.Before(ctx); err != nil { + return err + } + + return cli.HandleAction(graphExplorerCommand.Action, ctx) }, } } @@ -33,9 +34,6 @@ func configureGraphExplorer(cfg *config.Config) *svcconfig.Config { cfg.GraphExplorer.Log.Level = cfg.Log.Level cfg.GraphExplorer.Log.Pretty = cfg.Log.Pretty cfg.GraphExplorer.Log.Color = cfg.Log.Color - cfg.GraphExplorer.Tracing.Enabled = false - cfg.GraphExplorer.HTTP.Addr = "localhost:9135" - cfg.GraphExplorer.HTTP.Root = "/" return cfg.GraphExplorer } diff --git a/pkg/command/graph.go b/pkg/command/graph.go index 2ca43be8b..32d28311c 100644 --- a/pkg/command/graph.go +++ b/pkg/command/graph.go @@ -18,13 +18,14 @@ func GraphCommand(cfg *config.Config) *cli.Command { Usage: "Start graph server", Category: "Extensions", Flags: flagset.ServerWithConfig(cfg.Graph), - Action: func(c *cli.Context) error { - scfg := configureGraph(cfg) + Action: func(ctx *cli.Context) error { + graphCommand := command.Server(configureGraph(cfg)) - return cli.HandleAction( - command.Server(scfg).Action, - c, - ) + if err := graphCommand.Before(ctx); err != nil { + return err + } + + return cli.HandleAction(graphCommand.Action, ctx) }, } } @@ -33,9 +34,6 @@ func configureGraph(cfg *config.Config) *svcconfig.Config { cfg.Graph.Log.Level = cfg.Log.Level cfg.Graph.Log.Pretty = cfg.Log.Pretty cfg.Graph.Log.Color = cfg.Log.Color - cfg.Graph.Tracing.Enabled = false - cfg.Graph.HTTP.Addr = "localhost:9120" - cfg.Graph.HTTP.Root = "/" return cfg.Graph } diff --git a/pkg/command/konnectd.go b/pkg/command/konnectd.go index f9f7538ff..afd0f1ad5 100644 --- a/pkg/command/konnectd.go +++ b/pkg/command/konnectd.go @@ -1,4 +1,3 @@ - package command import ( @@ -18,14 +17,13 @@ func KonnectdCommand(cfg *config.Config) *cli.Command { Category: "Extensions", Flags: flagset.ServerWithConfig(cfg.Konnectd), Action: func(c *cli.Context) error { - serverConfig := configureKonnectd(cfg) - serverCommand := command.Server(serverConfig) + konnectdCommand := command.Server(configureKonnectd(cfg)) - if err := serverCommand.Before(c); err != nil { + if err := konnectdCommand.Before(c); err != nil { return err } - return cli.HandleAction(serverCommand.Action, c) + return cli.HandleAction(konnectdCommand.Action, c) }, } } @@ -34,9 +32,6 @@ func configureKonnectd(cfg *config.Config) *svcconfig.Config { cfg.Konnectd.Log.Level = cfg.Log.Level cfg.Konnectd.Log.Pretty = cfg.Log.Pretty cfg.Konnectd.Log.Color = cfg.Log.Color - cfg.Konnectd.Tracing.Enabled = false - cfg.Konnectd.HTTP.Addr = "localhost:9130" - cfg.Konnectd.HTTP.Root = "/" return cfg.Konnectd } diff --git a/pkg/command/ocs.go b/pkg/command/ocs.go index 375d44862..9a6f2cdcb 100644 --- a/pkg/command/ocs.go +++ b/pkg/command/ocs.go @@ -18,13 +18,14 @@ func OCSCommand(cfg *config.Config) *cli.Command { Usage: "Start ocs server", Category: "Extensions", Flags: flagset.ServerWithConfig(cfg.OCS), - Action: func(c *cli.Context) error { - scfg := configureOCS(cfg) + Action: func(ctx *cli.Context) error { + ocsCommand := command.Server(configureOCS(cfg)) - return cli.HandleAction( - command.Server(scfg).Action, - c, - ) + if err := ocsCommand.Before(ctx); err != nil { + return err + } + + return cli.HandleAction(ocsCommand.Action, ctx) }, } } @@ -33,9 +34,6 @@ func configureOCS(cfg *config.Config) *svcconfig.Config { cfg.OCS.Log.Level = cfg.Log.Level cfg.OCS.Log.Pretty = cfg.Log.Pretty cfg.OCS.Log.Color = cfg.Log.Color - cfg.OCS.Tracing.Enabled = false - cfg.OCS.HTTP.Addr = "localhost:9110" - cfg.OCS.HTTP.Root = "/" return cfg.OCS } diff --git a/pkg/command/phoenix.go b/pkg/command/phoenix.go index ec18e716e..334d6e18e 100644 --- a/pkg/command/phoenix.go +++ b/pkg/command/phoenix.go @@ -23,17 +23,16 @@ func PhoenixCommand(cfg *config.Config) *cli.Command { } cfg.Phoenix.Phoenix.Config.Apps = c.StringSlice("web-config-app") - return nil }, Action: func(c *cli.Context) error { + phoenixCommand := command.Server(configurePhoenix(cfg)) - scfg := configurePhoenix(cfg) + if err := phoenixCommand.Before(c); err != nil { + return err + } - return cli.HandleAction( - command.Server(scfg).Action, - c, - ) + return cli.HandleAction(phoenixCommand.Action, c) }, } } diff --git a/pkg/command/proxy.go b/pkg/command/proxy.go index fa8b75484..3ceb8b3a4 100644 --- a/pkg/command/proxy.go +++ b/pkg/command/proxy.go @@ -16,15 +16,14 @@ func ProxyCommand(cfg *config.Config) *cli.Command { Usage: "Start proxy server", Category: "Extensions", Flags: flagset.ServerWithConfig(cfg.Proxy), - Action: func(c *cli.Context) error { - serverConfig := configureProxy(cfg) - serverCommand := command.Server(serverConfig) + Action: func(ctx *cli.Context) error { + proxyCommand := command.Server(configureProxy(cfg)) - if err := serverCommand.Before(c); err != nil { + if err := proxyCommand.Before(ctx); err != nil { return err } - return cli.HandleAction(serverCommand.Action, c) + return cli.HandleAction(proxyCommand.Action, ctx) }, } } diff --git a/pkg/command/webdav.go b/pkg/command/webdav.go index 20921dfd7..d3c8821cb 100644 --- a/pkg/command/webdav.go +++ b/pkg/command/webdav.go @@ -19,12 +19,13 @@ func WebDAVCommand(cfg *config.Config) *cli.Command { Category: "Extensions", Flags: flagset.ServerWithConfig(cfg.WebDAV), Action: func(c *cli.Context) error { - scfg := configureWebDAV(cfg) + webdavCommand := command.Server(configureWebDAV(cfg)) - return cli.HandleAction( - command.Server(scfg).Action, - c, - ) + if err := webdavCommand.Before(c); err != nil { + return err + } + + return cli.HandleAction(webdavCommand.Action, c) }, } } @@ -33,9 +34,6 @@ func configureWebDAV(cfg *config.Config) *svcconfig.Config { cfg.WebDAV.Log.Level = cfg.Log.Level cfg.WebDAV.Log.Pretty = cfg.Log.Pretty cfg.WebDAV.Log.Color = cfg.Log.Color - cfg.WebDAV.Tracing.Enabled = false - cfg.WebDAV.HTTP.Addr = "localhost:9115" - cfg.WebDAV.HTTP.Root = "/" return cfg.WebDAV }