mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-03-12 20:27:12 -04:00
move commands to its scope
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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 != "/" {
|
||||
|
||||
Reference in New Issue
Block a user