Store supported config formats in a variable

This commit is contained in:
Anton Harniakou
2019-01-31 15:06:18 +03:00
committed by Bjørn Erik Pedersen
parent c52045bbb3
commit d9282cf98a
4 changed files with 7 additions and 4 deletions

View File

@@ -20,6 +20,10 @@ import (
"github.com/spf13/viper"
)
var (
ValidConfigFileExtensions = []string{"toml", "yaml", "yml", "json"}
)
// FromConfigString creates a config from the given YAML, JSON or TOML config. This is useful in tests.
func FromConfigString(config, configType string) (Provider, error) {
v := newViper()