Open zoumo opened 6 years ago
After reading the source code, I found that viper.ReadRemoteConfig is the same with viper.WatchRemoteConfig.
viper.ReadRemoteConfig
viper.WatchRemoteConfig
viper.ReadRemoteConfig invokes RemoteConfig.Get, in remote/remote.go
RemoteConfig.Get
remote/remote.go
func (rc remoteConfigProvider) Get(rp viper.RemoteProvider) (io.Reader, error) { cm, err := getConfigManager(rp) if err != nil { return nil, err } b, err := cm.Get(rp.Path()) if err != nil { return nil, err } return bytes.NewReader(b), nil }
viper.WatchRemoteConfig invokes RemoteConfig.Watch, in remote/remote.go
RemoteConfig.Watch
func (rc remoteConfigProvider) Watch(rp viper.RemoteProvider) (io.Reader, error) { cm, err := getConfigManager(rp) if err != nil { return nil, err } resp, err := cm.Get(rp.Path()) if err != nil { return nil, err } return bytes.NewReader(resp), nil }
Obviously, they are exactly the same. What's the purpose?
@spf13 @bep
After reading the source code, I found that
viper.ReadRemoteConfig
is the same withviper.WatchRemoteConfig
.viper.ReadRemoteConfig
invokesRemoteConfig.Get
, inremote/remote.go
viper.WatchRemoteConfig
invokesRemoteConfig.Watch
, inremote/remote.go
Obviously, they are exactly the same. What's the purpose?