mirror of
https://github.com/spf13/viper
synced 2024-12-22 19:47:01 +00:00
added error for remote configuration not found
This commit is contained in:
parent
c33e690687
commit
d2d8f6caa1
1 changed files with 7 additions and 2 deletions
9
viper.go
9
viper.go
|
@ -508,7 +508,6 @@ func insensativiseMaps() {
|
||||||
|
|
||||||
// retrieve the first found remote configuration
|
// retrieve the first found remote configuration
|
||||||
func getKeyValueConfig() error {
|
func getKeyValueConfig() error {
|
||||||
var err error
|
|
||||||
for _, rp := range remoteProviders {
|
for _, rp := range remoteProviders {
|
||||||
val, err := getRemoteConfig(rp)
|
val, err := getRemoteConfig(rp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -517,7 +516,13 @@ func getKeyValueConfig() error {
|
||||||
kvstore = val
|
kvstore = val
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return err
|
return RemoteConfigError("No Files Found")
|
||||||
|
}
|
||||||
|
|
||||||
|
type RemoteConfigError string
|
||||||
|
|
||||||
|
func (rce RemoteConfigError) Error() string {
|
||||||
|
return fmt.Sprintf("Remote Configurations Error: %s", string(rce))
|
||||||
}
|
}
|
||||||
|
|
||||||
func getRemoteConfig(provider *remoteProvider) (map[string]interface{}, error) {
|
func getRemoteConfig(provider *remoteProvider) (map[string]interface{}, error) {
|
||||||
|
|
Loading…
Reference in a new issue