forked from mirror/viper
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:")
|
||||
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) {
|
||||
SetConfigFile("/tmp/config.yaml")
|
||||
assert.Equal(t, "/tmp/config.yaml", getConfigFile())
|
||||
|
|
Loading…
Reference in New Issue