Skip to content

Commit

Permalink
Merge pull request #5732 from tstromberg/config-avail
Browse files Browse the repository at this point in the history
Hide innocuous viper ConfigFileNotFoundError
  • Loading branch information
tstromberg committed Oct 25, 2019
2 parents 80f0262 + a7a692d commit 991d84e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/minikube/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,11 @@ func initConfig() {
configPath := localpath.ConfigFile
viper.SetConfigFile(configPath)
viper.SetConfigType("json")
err := viper.ReadInConfig()
if err != nil {
glog.Warningf("Error reading config file at %s: %v", configPath, err)
if err := viper.ReadInConfig(); err != nil {
// This config file is optional, so don't emit errors if missing
if _, ok := err.(viper.ConfigFileNotFoundError); !ok {
glog.Warningf("Error reading config file at %s: %v", configPath, err)
}
}
setupViper()
}
Expand Down

0 comments on commit 991d84e

Please sign in to comment.