mirror of
https://github.com/spf13/viper
synced 2025-05-05 19:57:18 +00:00
Merge 85ce03af09
into 7c187a462c
This commit is contained in:
commit
df93238c7b
1 changed files with 7 additions and 6 deletions
13
file.go
13
file.go
|
@ -74,6 +74,13 @@ func (v *Viper) findConfigFileOld() (string, error) {
|
|||
|
||||
func (v *Viper) searchInPath(in string) (filename string) {
|
||||
v.logger.Debug("searching for config in path", "path", in)
|
||||
if v.configType != "" {
|
||||
if b, _ := exists(v.fs, filepath.Join(in, v.configName+"."+v.configType)); b {
|
||||
v.logger.Debug("found file", "file", filepath.Join(in, v.configName+"."+v.configType))
|
||||
return filepath.Join(in, v.configName+"."+v.configType)
|
||||
}
|
||||
}
|
||||
|
||||
for _, ext := range SupportedExts {
|
||||
v.logger.Debug("checking if file exists", "file", filepath.Join(in, v.configName+"."+ext))
|
||||
if b, _ := exists(v.fs, filepath.Join(in, v.configName+"."+ext)); b {
|
||||
|
@ -82,12 +89,6 @@ func (v *Viper) searchInPath(in string) (filename string) {
|
|||
}
|
||||
}
|
||||
|
||||
if v.configType != "" {
|
||||
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