From 5ada79089836fe065a96718a1882c510151fd85f Mon Sep 17 00:00:00 2001 From: eslin88 Date: Wed, 27 May 2020 17:33:03 +0800 Subject: [PATCH] support multitype remote config file --- viper.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/viper.go b/viper.go index f61f4ed..cd257a3 100644 --- a/viper.go +++ b/viper.go @@ -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 }