mirror of
https://github.com/spf13/viper
synced 2025-05-07 12:47:18 +00:00
Merge 65e8f0b086
into d493c32b69
This commit is contained in:
commit
0fdac11054
1 changed files with 8 additions and 1 deletions
9
viper.go
9
viper.go
|
@ -1245,7 +1245,14 @@ func (v *Viper) writeConfig(filename string, force bool) error {
|
||||||
if len(ext) <= 1 {
|
if len(ext) <= 1 {
|
||||||
return fmt.Errorf("Filename: %s requires valid extension.", filename)
|
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) {
|
if !stringInSlice(configType, SupportedExts) {
|
||||||
return UnsupportedConfigError(configType)
|
return UnsupportedConfigError(configType)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue