fix(be):使用初始化init 初始化一些参数

This commit is contained in:
neverteaser
2021-03-20 22:38:22 +08:00
committed by dushixiang
parent caa4ff1ffb
commit d76f782a01
5 changed files with 20 additions and 6 deletions

View File

@ -8,6 +8,8 @@ import (
"github.com/spf13/viper"
)
var GlobalCfg *Config
type Config struct {
Debug bool
Demo bool
@ -84,6 +86,10 @@ func SetupConfig() *Config {
Debug: viper.GetBool("debug"),
Demo: viper.GetBool("demo"),
}
GlobalCfg = config
return config
}
func init() {
GlobalCfg = SetupConfig()
}