Skip to content

Commit

Permalink
Report errors on unmarshal config
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Castell committed Dec 28, 2018
1 parent 80b2ab1 commit c5f5de0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/dkron.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,17 @@ func initConfig() {
logrus.WithError(err).Info("No valid config found: Applying default values.")
}

viper.Unmarshal(config)
if err := viper.Unmarshal(config); err != nil {
logrus.WithError(err).Fatal("config: Error unmarshaling config")
}

cliTags := viper.GetStringSlice("tag")
var tags map[string]string

if len(cliTags) > 0 {
tags, err = unmarshalTags(cliTags)
tags, err = UnmarshalTags(cliTags)
if err != nil {
logrus.Fatal("config: Error unmarshaling cli tags")
logrus.WithError(err).Fatal("config: Error unmarshaling cli tags")
}
} else {
tags = viper.GetStringMapString("tags")
Expand Down

0 comments on commit c5f5de0

Please sign in to comment.