run ParseConfig only when running unsupervised
This commit is contained in:
@@ -29,27 +29,31 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
Name: "server",
|
||||
Usage: "Start integrated server",
|
||||
Flags: flagset.ServerWithConfig(cfg),
|
||||
Before: func(c *cli.Context) error {
|
||||
|
||||
Before: func(ctx *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
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(c.StringSlice("trusted-proxy")) > 0 {
|
||||
cfg.IDP.TrustedProxy = c.StringSlice("trusted-proxy")
|
||||
if len(ctx.StringSlice("trusted-proxy")) > 0 {
|
||||
cfg.IDP.TrustedProxy = ctx.StringSlice("trusted-proxy")
|
||||
}
|
||||
|
||||
if len(c.StringSlice("allow-scope")) > 0 {
|
||||
cfg.IDP.AllowScope = c.StringSlice("allow-scope")
|
||||
if len(ctx.StringSlice("allow-scope")) > 0 {
|
||||
cfg.IDP.AllowScope = ctx.StringSlice("allow-scope")
|
||||
}
|
||||
|
||||
if len(c.StringSlice("signing-private-key")) > 0 {
|
||||
cfg.IDP.SigningPrivateKeyFiles = c.StringSlice("signing-private-key")
|
||||
if len(ctx.StringSlice("signing-private-key")) > 0 {
|
||||
cfg.IDP.SigningPrivateKeyFiles = ctx.StringSlice("signing-private-key")
|
||||
}
|
||||
|
||||
return ParseConfig(c, cfg)
|
||||
if !cfg.Supervised {
|
||||
return ParseConfig(ctx, cfg)
|
||||
}
|
||||
logger.Debug().Str("service", "idp").Msg("ignoring config file parsing when running supervised")
|
||||
return nil
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := NewLogger(cfg)
|
||||
|
||||
Reference in New Issue
Block a user