run ParseConfig only when running unsupervised

This commit is contained in:
A.Unger
2021-03-11 20:09:05 +01:00
parent dc4b4b7e46
commit b52fe95762
13 changed files with 80 additions and 42 deletions
-4
View File
@@ -23,16 +23,12 @@ func Execute(cfg *config.Config) error {
Version: version.String,
Usage: "Serve ownCloud Web for oCIS",
Compiled: version.Compiled(),
Authors: []*cli.Author{
{
Name: "ownCloud GmbH",
Email: "support@owncloud.com",
},
},
//Flags: flagset.RootWithConfig(cfg),
Commands: []*cli.Command{
Server(cfg),
Health(cfg),
+8 -5
View File
@@ -31,22 +31,25 @@ func Server(cfg *config.Config) *cli.Command {
Name: "server",
Usage: "Start integrated server",
Flags: append(flagset.ServerWithConfig(cfg), flagset.RootWithConfig(cfg)...),
Before: func(c *cli.Context) error {
Before: func(ctx *cli.Context) error {
logger := NewLogger(cfg)
if cfg.HTTP.Root != "/" {
cfg.HTTP.Root = strings.TrimRight(cfg.HTTP.Root, "/")
}
cfg.Web.Config.Apps = c.StringSlice("web-config-app")
cfg.Web.Config.Apps = ctx.StringSlice("web-config-app")
if err := ParseConfig(c, cfg); err != nil {
return err
if !cfg.Supervised {
if err := ParseConfig(ctx, cfg); err != nil {
return err
}
}
logger.Debug().Str("service", "web").Msg("ignoring config file parsing when running supervised")
// build well known openid-configuration endpoint if it is not set
if cfg.Web.Config.OpenIDConnect.MetadataURL == "" {
cfg.Web.Config.OpenIDConnect.MetadataURL = strings.TrimRight(cfg.Web.Config.OpenIDConnect.Authority, "/") + "/.well-known/openid-configuration"
}
return nil
},
Action: func(c *cli.Context) error {