diff --git a/accounts/pkg/command/root.go b/accounts/pkg/command/root.go index b84480007..b2f4740b1 100644 --- a/accounts/pkg/command/root.go +++ b/accounts/pkg/command/root.go @@ -3,6 +3,7 @@ package command import ( "context" "os" + "strings" "github.com/owncloud/ocis/accounts/pkg/config" ociscfg "github.com/owncloud/ocis/ocis-pkg/config" @@ -82,6 +83,12 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error { return err } + // sanitize config + if cfg.HTTP.Root != "/" { + cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/") + } + cfg.Repo.Backend = strings.ToLower(cfg.Repo.Backend) + return nil } diff --git a/accounts/pkg/command/server.go b/accounts/pkg/command/server.go index aa2c1b0c3..44feb3ffe 100644 --- a/accounts/pkg/command/server.go +++ b/accounts/pkg/command/server.go @@ -2,7 +2,6 @@ package command import ( "context" - "strings" "github.com/oklog/run" "github.com/owncloud/ocis/accounts/pkg/config" @@ -22,16 +21,10 @@ func Server(cfg *config.Config) *cli.Command { Usage: "Start ocis accounts service", Description: "uses an LDAP server as the storage backend", Before: func(ctx *cli.Context) error { - if cfg.HTTP.Root != "/" { - cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/") - } - if err := ParseConfig(ctx, cfg); err != nil { return err } - cfg.Repo.Backend = strings.ToLower(cfg.Repo.Backend) - return nil }, Action: func(c *cli.Context) error {