Skip to content

Commit 991d84e

Browse files
authored
Merge pull request #5732 from tstromberg/config-avail
Hide innocuous viper ConfigFileNotFoundError
2 parents 80f0262 + a7a692d commit 991d84e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cmd/minikube/cmd/root.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,11 @@ func initConfig() {
235235
configPath := localpath.ConfigFile
236236
viper.SetConfigFile(configPath)
237237
viper.SetConfigType("json")
238-
err := viper.ReadInConfig()
239-
if err != nil {
240-
glog.Warningf("Error reading config file at %s: %v", configPath, err)
238+
if err := viper.ReadInConfig(); err != nil {
239+
// This config file is optional, so don't emit errors if missing
240+
if _, ok := err.(viper.ConfigFileNotFoundError); !ok {
241+
glog.Warningf("Error reading config file at %s: %v", configPath, err)
242+
}
241243
}
242244
setupViper()
243245
}

0 commit comments

Comments
 (0)