Fix config unit tests
Recent changes to config and logging modules have left the tests needing to initialize both config and logging packages. This commit updates the config module to automatically initialize into at least useful defaults at module load time. This commit also fixes the config unit tests by using the more up to date interface that the package provides. Signed-off-by: Ava Affine <ava@sunnypup.io>
This commit is contained in:
parent
00fff032c7
commit
6afd0122c9
2 changed files with 13 additions and 4 deletions
|
|
@ -18,10 +18,22 @@ type AppConfig struct {
|
|||
|
||||
var config *AppConfig
|
||||
|
||||
func init() {
|
||||
setDefaults()
|
||||
viper.Unmarshal(&config)
|
||||
}
|
||||
|
||||
func Get() *AppConfig {
|
||||
return config
|
||||
}
|
||||
|
||||
func GetDefaultConfig() *AppConfig {
|
||||
var config *AppConfig
|
||||
setDefaults()
|
||||
viper.Unmarshal(&config)
|
||||
return config
|
||||
}
|
||||
|
||||
func Init() error {
|
||||
setDefaults()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue