@@ -1870,6 +1870,10 @@ func (v *Viper) getKeyValueConfig() error {
1870
1870
return RemoteConfigError ("Enable the remote features by doing a blank import of the viper/remote package: '_ github.com/spf13/viper/remote'" )
1871
1871
}
1872
1872
1873
+ if len (v .remoteProviders ) == 0 {
1874
+ return RemoteConfigError ("No Remote Providers" )
1875
+ }
1876
+
1873
1877
for _ , rp := range v .remoteProviders {
1874
1878
val , err := v .getRemoteConfig (rp )
1875
1879
if err != nil {
@@ -1896,6 +1900,10 @@ func (v *Viper) getRemoteConfig(provider RemoteProvider) (map[string]interface{}
1896
1900
1897
1901
// Retrieve the first found remote configuration.
1898
1902
func (v * Viper ) watchKeyValueConfigOnChannel () error {
1903
+ if len (v .remoteProviders ) == 0 {
1904
+ return RemoteConfigError ("No Remote Providers" )
1905
+ }
1906
+
1899
1907
for _ , rp := range v .remoteProviders {
1900
1908
respc , _ := RemoteConfig .WatchChannel (rp )
1901
1909
// Todo: Add quit channel
@@ -1913,9 +1921,15 @@ func (v *Viper) watchKeyValueConfigOnChannel() error {
1913
1921
1914
1922
// Retrieve the first found remote configuration.
1915
1923
func (v * Viper ) watchKeyValueConfig () error {
1924
+ if len (v .remoteProviders ) == 0 {
1925
+ return RemoteConfigError ("No Remote Providers" )
1926
+ }
1927
+
1916
1928
for _ , rp := range v .remoteProviders {
1917
1929
val , err := v .watchRemoteConfig (rp )
1918
1930
if err != nil {
1931
+ v .logger .Error (fmt .Errorf ("watch remote config: %w" , err ).Error ())
1932
+
1919
1933
continue
1920
1934
}
1921
1935
v .kvstore = val
0 commit comments