move commands to its scope

This commit is contained in:
A.Unger committed 2020-03-16 17:17:56 +01:00
1 parent 52bb4c0e1a
commit c9010a3016
2 files changed
+9 -6

No files matched your search

+9 -4
View File
@@ -35,10 +35,7 @@ func Execute() error {
return ParseConfig(c, cfg)
},
Commands: []*cli.Command{
Server(cfg),
Health(cfg),
},
Commands: GetCommands(cfg),
}
cli.HelpFlag = &cli.BoolFlag{
@@ -54,6 +51,14 @@ func Execute() error {
return app.Run(os.Args)
}
// GetCommands undocummented
func GetCommands(cfg *config.Config) []*cli.Command {
return []*cli.Command{
Server(cfg),
Health(cfg),
}
}
// NewLogger initializes a service-specific logger instance.
func NewLogger(cfg *config.Config) log.Logger {
return log.NewLogger(
-2
View File
@@ -31,8 +31,6 @@ func Server(cfg *config.Config) *cli.Command {
Usage: "Start integrated server",
Flags: flagset.ServerWithConfig(cfg),
Before: func(ctx *cli.Context) error {
// commands are loaded asynchronously, config gets lost along the way,
// therefore we need to run this routine again, since a new config is passed each time.
ParseConfig(ctx, cfg)
if cfg.HTTP.Root != "/" {