mirror of
https://github.com/spf13/viper
synced 2024-12-23 03:57:01 +00:00
feat: read remote config shoud not merge kvstore
This commit is contained in:
parent
336e9f0a93
commit
fa85280436
1 changed files with 3 additions and 5 deletions
8
viper.go
8
viper.go
|
@ -1944,24 +1944,22 @@ func (v *Viper) getKeyValueConfig() error {
|
||||||
val, err := v.getRemoteConfig(rp)
|
val, err := v.getRemoteConfig(rp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
v.logger.Error(fmt.Errorf("get remote config: %w", err).Error())
|
v.logger.Error(fmt.Errorf("get remote config: %w", err).Error())
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
v.kvstore = val
|
v.kvstore = val
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return RemoteConfigError("No Files Found")
|
return RemoteConfigError("No Files Found")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *Viper) getRemoteConfig(provider RemoteProvider) (map[string]interface{}, error) {
|
func (v *Viper) getRemoteConfig(provider RemoteProvider) (map[string]interface{}, error) {
|
||||||
|
config := make(map[string]interface{})
|
||||||
reader, err := RemoteConfig.Get(provider)
|
reader, err := RemoteConfig.Get(provider)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
err = v.unmarshalReader(reader, v.kvstore)
|
err = v.unmarshalReader(reader, config)
|
||||||
return v.kvstore, err
|
return config, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve the first found remote configuration.
|
// Retrieve the first found remote configuration.
|
||||||
|
|
Loading…
Reference in a new issue