diff --git a/ocis-phoenix/pkg/command/root.go b/ocis-phoenix/pkg/command/root.go index a1958370b..d03c2d279 100644 --- a/ocis-phoenix/pkg/command/root.go +++ b/ocis-phoenix/pkg/command/root.go @@ -31,10 +31,6 @@ func Execute() error { Flags: flagset.RootWithConfig(cfg), - Before: func(c *cli.Context) error { - return ParseConfig(c, cfg) - }, - Commands: []*cli.Command{ Server(cfg), Health(cfg), @@ -86,22 +82,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/ocis-phoenix/pkg/flagset/flagset.go b/ocis-phoenix/pkg/flagset/flagset.go index ecfd02828..45eadde1d 100644 --- a/ocis-phoenix/pkg/flagset/flagset.go +++ b/ocis-phoenix/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{"PHOENIX_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{"PHOENIX_CONFIG_FILE"}, + Destination: &cfg.File, + }, &cli.BoolFlag{ Name: "tracing-enabled", Usage: "Enable sending traces",