wip correctly parse config

This commit is contained in:
A.Unger
2020-10-09 11:24:04 +02:00
parent f2d560ff0f
commit 8fe3ac9b33
4 changed files with 15 additions and 17 deletions
+6 -5
View File
@@ -33,7 +33,8 @@ func Execute() error {
Before: func(c *cli.Context) error {
cfg.Service.Version = version.String
return ParseConfig(c, cfg)
return nil
//return ParseConfig(c, cfg)
},
Commands: []*cli.Command{
@@ -87,16 +88,16 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error {
if err := viper.ReadInConfig(); err != nil {
switch err.(type) {
case viper.ConfigFileNotFoundError:
logger.Info().
Msg("Continue without config")
logger.Debug().
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")
}
}