parse config regardless of supervised / unsupervised

This commit is contained in:
A.Unger
2021-10-31 00:30:48 +02:00
parent 18b55367fa
commit 7df000d06f
3 changed files with 12 additions and 23 deletions
+5 -11
View File
@@ -39,14 +39,15 @@ func Server(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "server",
Usage: "Start integrated server",
//Flags: append(flagset.ServerWithConfig(cfg), flagset.RootWithConfig(cfg)...),
Before: func(ctx *cli.Context) error {
logger := NewLogger(cfg)
if err := ParseConfig(ctx, cfg); err != nil {
return err
}
if cfg.HTTP.Root != "/" {
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
}
// StringSliceFlag doesn't support Destination
// UPDATE Destination on string flags supported. Wait for https://github.com/urfave/cli/pull/1078 to get to micro/cli
if len(ctx.StringSlice("presignedurl-allow-method")) > 0 {
cfg.PreSignedURL.AllowedHTTPMethods = ctx.StringSlice("presignedurl-allow-method")
}
@@ -55,13 +56,6 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
if err := ParseConfig(ctx, cfg); err != nil {
panic(err)
}
//if !cfg.Supervised {
// return ParseConfig(ctx, cfg)
//}
logger.Debug().Str("service", "ocs").Msg("ignoring config file parsing when running supervised")
return nil
},
Action: func(c *cli.Context) error {