github.com/devcamcar/cli@v0.0.0-20181107134215-706a05759d18/client/api.go (about) 1 package client 2 3 import ( 4 "github.com/fnproject/cli/config" 5 "github.com/fnproject/fn_go" 6 "github.com/fnproject/fn_go/provider" 7 "github.com/spf13/viper" 8 ) 9 10 type viperConfigSource struct { 11 } 12 13 func (*viperConfigSource) GetString(key string) string { 14 return viper.GetString(key) 15 } 16 17 func (*viperConfigSource) GetBool(key string) bool { 18 return viper.GetBool(key) 19 } 20 func (*viperConfigSource) IsSet(key string) bool { 21 return viper.IsSet(key) 22 } 23 24 func CurrentProvider() (provider.Provider, error) { 25 return fn_go.DefaultProviders.ProviderFromConfig(viper.GetString(config.ContextProvider), &viperConfigSource{}, &provider.TerminalPassPhraseSource{}) 26 }