feat: read remote config shoud not merge kvstore

This commit is contained in:
Astone 2023-09-14 13:58:27 +08:00 committed by GitHub
parent 336e9f0a93
commit fa85280436
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -1944,24 +1944,22 @@ func (v *Viper) getKeyValueConfig() error {
val, err := v.getRemoteConfig(rp)
if err != nil {
v.logger.Error(fmt.Errorf("get remote config: %w", err).Error())
continue
}
v.kvstore = val
return nil
}
return RemoteConfigError("No Files Found")
}
func (v *Viper) getRemoteConfig(provider RemoteProvider) (map[string]interface{}, error) {
config := make(map[string]interface{})
reader, err := RemoteConfig.Get(provider)
if err != nil {
return nil, err
}
err = v.unmarshalReader(reader, v.kvstore)
return v.kvstore, err
err = v.unmarshalReader(reader, config)
return config, err
}
// Retrieve the first found remote configuration.