support multitype remote config file

This commit is contained in:
eslin88 2020-05-27 17:33:03 +08:00
parent 13df721090
commit 5ada790898
1 changed files with 6 additions and 0 deletions

View File

@ -1790,6 +1790,12 @@ func (v *Viper) getRemoteConfig(provider RemoteProvider) (map[string]interface{}
if err != nil { if err != nil {
return nil, err 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) err = v.unmarshalReader(reader, v.kvstore)
return v.kvstore, err return v.kvstore, err
} }