(in string)
| 73 | } |
| 74 | |
| 75 | func (v *Viper) searchInPath(in string) (filename string) { |
| 76 | v.logger.Debug("searching for config in path", "path", in) |
| 77 | for _, ext := range SupportedExts { |
| 78 | v.logger.Debug("checking if file exists", "file", filepath.Join(in, v.configName+"."+ext)) |
| 79 | if b, _ := exists(v.fs, filepath.Join(in, v.configName+"."+ext)); b { |
| 80 | v.logger.Debug("found file", "file", filepath.Join(in, v.configName+"."+ext)) |
| 81 | return filepath.Join(in, v.configName+"."+ext) |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | if v.configType != "" { |
| 86 | if b, _ := exists(v.fs, filepath.Join(in, v.configName)); b { |
| 87 | return filepath.Join(in, v.configName) |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | return "" |
| 92 | } |
| 93 | |
| 94 | // exists checks if file exists. |
| 95 | func exists(fs afero.Fs, path string) (bool, error) { |
no test coverage detected