This commit is contained in:
cmohrb 2018-07-13 14:28:44 +00:00 committed by GitHub
commit 0fdac11054
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1245,7 +1245,14 @@ func (v *Viper) writeConfig(filename string, force bool) error {
if len(ext) <= 1 {
return fmt.Errorf("Filename: %s requires valid extension.", filename)
}
configType := ext[1:]
var configType string
if v.configType == "" {
configType = ext[1:]
} else {
configType = v.configType
}
if !stringInSlice(configType, SupportedExts) {
return UnsupportedConfigError(configType)
}