From 7b71291b35e77d125bd5503b58025edbb1d682be Mon Sep 17 00:00:00 2001 From: Ross Cooperman Date: Thu, 19 Feb 2015 10:39:44 -0500 Subject: [PATCH] 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. --- viper.go | 9 +++++++++ viper_test.go | 7 ------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/viper.go b/viper.go index 89834b7..dda7091 100644 --- a/viper.go +++ b/viper.go @@ -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 diff --git a/viper_test.go b/viper_test.go index 92e62cc..2c665ec 100644 --- a/viper_test.go +++ b/viper_test.go @@ -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",