This commit is contained in:
Rajat M 2025-03-30 14:02:17 +00:00 committed by GitHub
commit 96a5a9a05b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1491,6 +1491,11 @@ func (v *Viper) ReadInConfig() error {
return UnsupportedConfigError(v.getConfigType()) return UnsupportedConfigError(v.getConfigType())
} }
fileExist, err := afero.Exists(v.fs, filename)
if !fileExist {
return ConfigFileNotFoundError{filename, fmt.Sprintf("%s", v.configPaths)}
}
v.logger.Debug("reading file", "file", filename) v.logger.Debug("reading file", "file", filename)
file, err := afero.ReadFile(v.fs, filename) file, err := afero.ReadFile(v.fs, filename)
if err != nil { if err != nil {