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:
Ross Cooperman 2015-02-19 10:39:44 -05:00 committed by spf13
parent 6c5a915341
commit 90734830d1
2 changed files with 9 additions and 7 deletions

View file

@ -102,6 +102,15 @@ func New() *viper {
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
// to connect to a remote key/value store.
// Optional secretKeyring to unencrypt encrypted values

View file

@ -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(`{
"id":"0002",
"type":"cronut",