mirror of
https://github.com/spf13/viper
synced 2024-12-22 19:47:01 +00:00
fix #1505 viper.SetConfigFile()
This commit is contained in:
parent
adc3a873f0
commit
24f9ebe82b
1 changed files with 2 additions and 2 deletions
4
viper.go
4
viper.go
|
@ -1563,7 +1563,7 @@ func (v *Viper) ReadInConfig() error {
|
||||||
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 {
|
||||||
return err
|
return ConfigFileNotFoundError{v.configName, fmt.Sprintf("%s", v.configPaths)}
|
||||||
}
|
}
|
||||||
|
|
||||||
config := make(map[string]interface{})
|
config := make(map[string]interface{})
|
||||||
|
@ -1593,7 +1593,7 @@ func (v *Viper) MergeInConfig() error {
|
||||||
|
|
||||||
file, err := afero.ReadFile(v.fs, filename)
|
file, err := afero.ReadFile(v.fs, filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return ConfigFileNotFoundError{v.configName, fmt.Sprintf("%s", v.configPaths)}
|
||||||
}
|
}
|
||||||
|
|
||||||
return v.MergeConfig(bytes.NewReader(file))
|
return v.MergeConfig(bytes.NewReader(file))
|
||||||
|
|
Loading…
Reference in a new issue