From fa852804368168e0ee6000b9b08df97a933006ea Mon Sep 17 00:00:00 2001 From: Astone <11812510+acynothia@users.noreply.github.com> Date: Thu, 14 Sep 2023 13:58:27 +0800 Subject: [PATCH] feat: read remote config shoud not merge kvstore --- viper.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/viper.go b/viper.go index 097483b..f8c2f7b 100644 --- a/viper.go +++ b/viper.go @@ -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.