mirror of
https://github.com/spf13/viper
synced 2024-12-23 03:57:01 +00:00
Move viper.Reset() back to the public interface
It is helpful for applications that use viper to be able to reset their configurations between test runs.
This commit is contained in:
parent
6c5a915341
commit
7b71291b35
2 changed files with 9 additions and 7 deletions
9
viper.go
9
viper.go
|
@ -102,6 +102,15 @@ func New() *viper {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Intended for testing, will reset all to default settings.
|
||||||
|
// In the public interface for the viper package so applications
|
||||||
|
// can use it in their testing as well.
|
||||||
|
func Reset() {
|
||||||
|
v = New()
|
||||||
|
SupportedExts = []string{"json", "toml", "yaml", "yml"}
|
||||||
|
SupportedRemoteProviders = []string{"etcd", "consul"}
|
||||||
|
}
|
||||||
|
|
||||||
// remoteProvider stores the configuration necessary
|
// remoteProvider stores the configuration necessary
|
||||||
// to connect to a remote key/value store.
|
// to connect to a remote key/value store.
|
||||||
// Optional secretKeyring to unencrypt encrypted values
|
// Optional secretKeyring to unencrypt encrypted values
|
||||||
|
|
|
@ -54,13 +54,6 @@ var jsonExample = []byte(`{
|
||||||
}
|
}
|
||||||
}`)
|
}`)
|
||||||
|
|
||||||
// Intended for testing, will reset all to default settings.
|
|
||||||
func Reset() {
|
|
||||||
v = New()
|
|
||||||
SupportedExts = []string{"json", "toml", "yaml", "yml"}
|
|
||||||
SupportedRemoteProviders = []string{"etcd", "consul"}
|
|
||||||
}
|
|
||||||
|
|
||||||
var remoteExample = []byte(`{
|
var remoteExample = []byte(`{
|
||||||
"id":"0002",
|
"id":"0002",
|
||||||
"type":"cronut",
|
"type":"cronut",
|
||||||
|
|
Loading…
Reference in a new issue