mirror of https://github.com/spf13/viper.git
Added Reset Function
This commit is contained in:
parent
8b744a9310
commit
25817ada59
15
viper.go
15
viper.go
|
@ -385,3 +385,18 @@ func Debug() {
|
||||||
fmt.Println("Override:")
|
fmt.Println("Override:")
|
||||||
pretty.Println(override)
|
pretty.Println(override)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Reset() {
|
||||||
|
configPaths = nil
|
||||||
|
configName = "config"
|
||||||
|
|
||||||
|
// extensions Supported
|
||||||
|
SupportedExts = []string{"json", "toml", "yaml"}
|
||||||
|
configFile = ""
|
||||||
|
configType = ""
|
||||||
|
|
||||||
|
config = make(map[string]interface{})
|
||||||
|
override = make(map[string]interface{})
|
||||||
|
defaults = make(map[string]interface{})
|
||||||
|
aliases = make(map[string]string)
|
||||||
|
}
|
||||||
|
|
|
@ -43,21 +43,6 @@ var jsonExample = []byte(`{
|
||||||
}
|
}
|
||||||
}`)
|
}`)
|
||||||
|
|
||||||
func reset() {
|
|
||||||
configPaths = nil
|
|
||||||
configName = "config"
|
|
||||||
|
|
||||||
// extensions Supported
|
|
||||||
SupportedExts = []string{"json", "toml", "yaml"}
|
|
||||||
configFile = ""
|
|
||||||
configType = ""
|
|
||||||
|
|
||||||
config = make(map[string]interface{})
|
|
||||||
override = make(map[string]interface{})
|
|
||||||
defaults = make(map[string]interface{})
|
|
||||||
aliases = make(map[string]string)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestBasics(t *testing.T) {
|
func TestBasics(t *testing.T) {
|
||||||
SetConfigFile("/tmp/config.yaml")
|
SetConfigFile("/tmp/config.yaml")
|
||||||
assert.Equal(t, "/tmp/config.yaml", getConfigFile())
|
assert.Equal(t, "/tmp/config.yaml", getConfigFile())
|
||||||
|
|
Loading…
Reference in New Issue