mirror of
https://github.com/spf13/viper
synced 2025-05-07 20:57:18 +00:00
First look for config file with extension and only after fallback to no extension
This commit is contained in:
parent
895aadc1d8
commit
1107623164
1 changed files with 4 additions and 4 deletions
8
viper.go
8
viper.go
|
@ -1873,10 +1873,6 @@ func (v *Viper) getConfigFile() (string, error) {
|
|||
|
||||
func (v *Viper) searchInPath(in string) (filename string) {
|
||||
jww.DEBUG.Println("Searching for config in ", in)
|
||||
if b, _ := exists(v.fs, filepath.Join(in, v.configName)); b {
|
||||
return filepath.Join(in, v.configName)
|
||||
}
|
||||
|
||||
for _, ext := range SupportedExts {
|
||||
jww.DEBUG.Println("Checking for", filepath.Join(in, v.configName+"."+ext))
|
||||
if b, _ := exists(v.fs, filepath.Join(in, v.configName+"."+ext)); b {
|
||||
|
@ -1885,6 +1881,10 @@ func (v *Viper) searchInPath(in string) (filename string) {
|
|||
}
|
||||
}
|
||||
|
||||
if b, _ := exists(v.fs, filepath.Join(in, v.configName)); b {
|
||||
return filepath.Join(in, v.configName)
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue