diff --git a/accounts/pkg/command/server.go b/accounts/pkg/command/server.go index 47c01f7fb8..7228316e9d 100644 --- a/accounts/pkg/command/server.go +++ b/accounts/pkg/command/server.go @@ -32,13 +32,18 @@ func Server(cfg *config.Config) *cli.Command { Description: "uses an LDAP server as the storage backend", Flags: flagset.ServerWithConfig(cfg), Before: func(ctx *cli.Context) error { + logger := NewLogger(cfg) if cfg.HTTP.Root != "/" { cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/") } // When running on single binary mode the before hook from the root command won't get called. We manually // call this before hook from ocis command, so the configuration can be loaded. - return ParseConfig(ctx, cfg) + if !cfg.Supervised { + return ParseConfig(ctx, cfg) + } + logger.Debug().Str("service", "accounts").Msg("ignoring config file parsing when running supervised") + return nil }, Action: func(c *cli.Context) error { logger := NewLogger(cfg) diff --git a/glauth/pkg/command/server.go b/glauth/pkg/command/server.go index 9510955ea4..9a0cf021de 100644 --- a/glauth/pkg/command/server.go +++ b/glauth/pkg/command/server.go @@ -37,15 +37,18 @@ 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, "/") } - - cfg.Backend.Servers = c.StringSlice("backend-server") - cfg.Fallback.Servers = c.StringSlice("fallback-server") - - return ParseConfig(c, cfg) + cfg.Backend.Servers = ctx.StringSlice("backend-server") + cfg.Fallback.Servers = ctx.StringSlice("fallback-server") + if !cfg.Supervised { + return ParseConfig(ctx, cfg) + } + logger.Debug().Str("service", "glauth").Msg("ignoring config file parsing when running supervised") + return nil }, Action: func(c *cli.Context) error { logger := NewLogger(cfg) diff --git a/idp/pkg/command/server.go b/idp/pkg/command/server.go index 464106159d..0c3dbfdf25 100644 --- a/idp/pkg/command/server.go +++ b/idp/pkg/command/server.go @@ -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) diff --git a/ocs/pkg/command/server.go b/ocs/pkg/command/server.go index 356a423c6a..07e31fa5b3 100644 --- a/ocs/pkg/command/server.go +++ b/ocs/pkg/command/server.go @@ -29,12 +29,17 @@ 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, "/") } - return ParseConfig(c, cfg) + 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 { logger := NewLogger(cfg) diff --git a/onlyoffice/pkg/command/server.go b/onlyoffice/pkg/command/server.go index 47694769b4..27290d36ae 100644 --- a/onlyoffice/pkg/command/server.go +++ b/onlyoffice/pkg/command/server.go @@ -30,11 +30,16 @@ func Server(cfg *config.Config) *cli.Command { Usage: "Start integrated server", Flags: flagset.ServerWithConfig(cfg), Before: func(ctx *cli.Context) error { + logger := NewLogger(cfg) if cfg.HTTP.Root != "/" { cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/") } - return ParseConfig(ctx, cfg) + if !cfg.Supervised { + return ParseConfig(ctx, cfg) + } + logger.Debug().Str("service", "onlyoffice").Msg("ignoring config file parsing when running supervised") + return nil }, Action: func(c *cli.Context) error { logger := NewLogger(cfg) diff --git a/proxy/pkg/command/root.go b/proxy/pkg/command/root.go index 2de11abaa1..ef72673d01 100644 --- a/proxy/pkg/command/root.go +++ b/proxy/pkg/command/root.go @@ -37,7 +37,6 @@ func Execute(cfg *config.Config) error { Before: func(c *cli.Context) error { cfg.Service.Version = version.String return nil - //return ParseConfig(c, cfg) }, Commands: []*cli.Command{ diff --git a/proxy/pkg/command/server.go b/proxy/pkg/command/server.go index fe5d6821a9..fd20784736 100644 --- a/proxy/pkg/command/server.go +++ b/proxy/pkg/command/server.go @@ -47,6 +47,7 @@ func Server(cfg *config.Config) *cli.Command { Usage: "Start integrated server", Flags: append(flagset.ServerWithConfig(cfg), flagset.RootWithConfig(cfg)...), Before: func(ctx *cli.Context) error { + logger := NewLogger(cfg) if cfg.HTTP.Root != "/" { cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/") } @@ -56,13 +57,10 @@ func Server(cfg *config.Config) *cli.Command { return err } - if err := ParseConfig(ctx, cfg); err != nil { - return err + if !cfg.Supervised { + return ParseConfig(ctx, cfg) } - - // TODO we could parse OCIS_URL and set the PROXY_HTTP_ADDR port but that would make it harder to deploy with a - // reverse proxy ... wouldn't it? - + logger.Debug().Str("service", "ocs").Msg("ignoring config file parsing when running supervised") return nil }, Action: func(c *cli.Context) error { diff --git a/settings/pkg/command/server.go b/settings/pkg/command/server.go index 2a4e869f04..6f6af28294 100644 --- a/settings/pkg/command/server.go +++ b/settings/pkg/command/server.go @@ -32,13 +32,18 @@ func Server(cfg *config.Config) *cli.Command { Usage: "Start integrated server", Flags: flagset.ServerWithConfig(cfg), Before: func(ctx *cli.Context) error { + logger := NewLogger(cfg) if cfg.HTTP.Root != "/" { cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/") } // When running on single binary mode the before hook from the root command won't get called. We manually // call this before hook from ocis command, so the configuration can be loaded. - return ParseConfig(ctx, cfg) + if !cfg.Supervised { + return ParseConfig(ctx, cfg) + } + logger.Debug().Str("service", "settings").Msg("ignoring config file parsing when running supervised") + return nil }, Action: func(c *cli.Context) error { logger := NewLogger(cfg) diff --git a/store/pkg/command/server.go b/store/pkg/command/server.go index 4e17246dad..1ce3616052 100644 --- a/store/pkg/command/server.go +++ b/store/pkg/command/server.go @@ -30,9 +30,14 @@ func Server(cfg *config.Config) *cli.Command { Usage: "Start integrated server", Flags: flagset.ServerWithConfig(cfg), Before: func(ctx *cli.Context) error { + logger := NewLogger(cfg) // When running on single binary mode the before hook from the root command won't get called. We manually // call this before hook from ocis command, so the configuration can be loaded. - return ParseConfig(ctx, cfg) + if !cfg.Supervised { + return ParseConfig(ctx, cfg) + } + logger.Debug().Str("service", "store").Msg("ignoring config file parsing when running supervised") + return nil }, Action: func(c *cli.Context) error { logger := NewLogger(cfg) diff --git a/thumbnails/pkg/command/server.go b/thumbnails/pkg/command/server.go index d1de5dfec4..3818c9ab43 100644 --- a/thumbnails/pkg/command/server.go +++ b/thumbnails/pkg/command/server.go @@ -29,10 +29,15 @@ func Server(cfg *config.Config) *cli.Command { Name: "server", Usage: "Start integrated server", Flags: flagset.ServerWithConfig(cfg), - Before: func(c *cli.Context) error { - cfg.Thumbnail.Resolutions = c.StringSlice("thumbnail-resolution") + Before: func(ctx *cli.Context) error { + logger := NewLogger(cfg) + cfg.Thumbnail.Resolutions = ctx.StringSlice("thumbnail-resolution") - return ParseConfig(c, cfg) + if !cfg.Supervised { + return ParseConfig(ctx, cfg) + } + logger.Debug().Str("service", "thumbnails").Msg("ignoring config file parsing when running supervised") + return nil }, Action: func(c *cli.Context) error { logger := NewLogger(cfg) diff --git a/web/pkg/command/root.go b/web/pkg/command/root.go index 0c0a2b3c62..863ee56d45 100644 --- a/web/pkg/command/root.go +++ b/web/pkg/command/root.go @@ -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), diff --git a/web/pkg/command/server.go b/web/pkg/command/server.go index ba2c620536..794056eaa5 100644 --- a/web/pkg/command/server.go +++ b/web/pkg/command/server.go @@ -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 { diff --git a/webdav/pkg/command/server.go b/webdav/pkg/command/server.go index efbb310350..75a43f5700 100644 --- a/webdav/pkg/command/server.go +++ b/webdav/pkg/command/server.go @@ -29,12 +29,17 @@ 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, "/") } - return ParseConfig(c, cfg) + if !cfg.Supervised { + return ParseConfig(ctx, cfg) + } + logger.Debug().Str("service", "webdav").Msg("ignoring config file parsing when running supervised") + return nil }, Action: func(c *cli.Context) error { logger := NewLogger(cfg)