mirror of
https://github.com/spf13/viper
synced 2025-05-06 20:27:17 +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 {
|
||||
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)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue