mirror of
https://github.com/spf13/viper
synced 2024-12-23 12:07:02 +00:00
Expose the default Viper instance through methods.
To open up programming switching of configs, related to https://github.com/spf13/hugo/pull/1734
This commit is contained in:
parent
0c82789feb
commit
963ca4f768
1 changed files with 12 additions and 0 deletions
12
viper.go
12
viper.go
|
@ -174,6 +174,18 @@ func New() *Viper {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DefaultConfig retrieves the default Viper instance. To be loaded
|
||||||
|
// later with SetDefaultConfig.
|
||||||
|
func DefaultConfig() *Viper {
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaultConfig applies this Viper instance as the default. Used
|
||||||
|
// when calling the functions defined in the viper package.
|
||||||
|
func SetDefaultConfig(conf *Viper) {
|
||||||
|
v = conf
|
||||||
|
}
|
||||||
|
|
||||||
// Intended for testing, will reset all to default settings.
|
// Intended for testing, will reset all to default settings.
|
||||||
// In the public interface for the viper package so applications
|
// In the public interface for the viper package so applications
|
||||||
// can use it in their testing as well.
|
// can use it in their testing as well.
|
||||||
|
|
Loading…
Reference in a new issue