From cfa913e936d98949e057ad941e7518bac577d004 Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Wed, 4 Nov 2020 15:34:44 +0100 Subject: [PATCH] adjust ocs --- ocs/pkg/command/root.go | 12 ++++++------ ocs/pkg/flagset/flagset.go | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ocs/pkg/command/root.go b/ocs/pkg/command/root.go index 33cea710a5..6249dbf596 100644 --- a/ocs/pkg/command/root.go +++ b/ocs/pkg/command/root.go @@ -5,10 +5,10 @@ import ( "strings" "github.com/micro/cli/v2" + "github.com/owncloud/ocis/ocis-pkg/log" "github.com/owncloud/ocis/ocs/pkg/config" "github.com/owncloud/ocis/ocs/pkg/flagset" "github.com/owncloud/ocis/ocs/pkg/version" - "github.com/owncloud/ocis/ocis-pkg/log" "github.com/spf13/viper" ) @@ -33,7 +33,7 @@ func Execute() error { Before: func(c *cli.Context) error { cfg.Service.Version = version.String - return ParseConfig(c, cfg) + return nil }, Commands: []*cli.Command{ @@ -88,22 +88,22 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error { switch err.(type) { case viper.ConfigFileNotFoundError: logger.Info(). - Msg("Continue without config") + Msg("no config found on preconfigured location") case viper.UnsupportedConfigError: logger.Fatal(). Err(err). - Msg("Unsupported config type") + Msg("unsupported config type") default: logger.Fatal(). Err(err). - Msg("Failed to read config") + Msg("failed to read config") } } if err := viper.Unmarshal(&cfg); err != nil { logger.Fatal(). Err(err). - Msg("Failed to parse config") + Msg("failed to parse config") } return nil diff --git a/ocs/pkg/flagset/flagset.go b/ocs/pkg/flagset/flagset.go index 0e030a35c0..21665d9aa5 100644 --- a/ocs/pkg/flagset/flagset.go +++ b/ocs/pkg/flagset/flagset.go @@ -8,13 +8,6 @@ import ( // RootWithConfig applies cfg to the root flagset func RootWithConfig(cfg *config.Config) []cli.Flag { return []cli.Flag{ - &cli.StringFlag{ - Name: "config-file", - Value: "", - Usage: "Path to config file", - EnvVars: []string{"OCS_CONFIG_FILE"}, - Destination: &cfg.File, - }, &cli.StringFlag{ Name: "log-level", Value: "info", @@ -55,6 +48,13 @@ func HealthWithConfig(cfg *config.Config) []cli.Flag { // ServerWithConfig applies cfg to the root flagset func ServerWithConfig(cfg *config.Config) []cli.Flag { return []cli.Flag{ + &cli.StringFlag{ + Name: "config-file", + Value: "", + Usage: "Path to config file", + EnvVars: []string{"OCS_CONFIG_FILE"}, + Destination: &cfg.File, + }, &cli.BoolFlag{ Name: "tracing-enabled", Value: false,