update all sub commands

This commit is contained in:
A.Unger
2020-03-17 15:01:09 +01:00
parent 076383e79d
commit 74fd634a2b
7 changed files with 39 additions and 54 deletions

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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)
},
}
}

View File

@@ -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)
},
}
}

View File

@@ -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
}