Fix for build failure - viper now uses ConfigFileNotFoundError

Change-Id: I51c4fe26239c4a7bf750e0a6a66b452d9138832f
This commit is contained in:
Davanum Srinivas 2019-05-27 20:22:37 -04:00
parent 71a7be41e0
commit 011911022d
No known key found for this signature in database
GPG Key ID: 80D83A796103BF59

View File

@ -78,10 +78,16 @@ func ViperizeFlags(requiredConfig, optionalConfig string) error {
// "file not found". Unfortunately error
// messages are sometimes hard to understand,
// so try to help the user a bit.
switch err.Error() {
case viperFileNotFound:
switch err.(type) {
case viper.ConfigFileNotFoundError:
if required {
return wrapError(errors.New("not found or not using a supported file format"))
return wrapError(errors.New("not found"))
}
// Proceed without config.
return nil
case viper.UnsupportedConfigError:
if required {
return wrapError(errors.New("not using a supported file format"))
}
// Proceed without config.
return nil