support multitype remote config file

This commit is contained in:
eslin88 2020-05-27 17:33:03 +08:00
parent 13df721090
commit 5ada790898

View file

@ -1790,6 +1790,12 @@ func (v *Viper) getRemoteConfig(provider RemoteProvider) (map[string]interface{}
if err != nil {
return nil, err
}
providerType := strings.Split(provider.Path(), ".")[len(strings.Split(provider.Path(), "."))-1]
if v.getConfigType() == "" && stringInSlice(providerType, SupportedExts) {
SetConfigType(providerType)
}
err = v.unmarshalReader(reader, v.kvstore)
return v.kvstore, err
}