mirror of
https://github.com/spf13/viper
synced 2024-12-22 03:27:03 +00:00
Added Reset Function
This commit is contained in:
parent
8b744a9310
commit
25817ada59
2 changed files with 15 additions and 15 deletions
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 a new issue