fix(be):使用初始化init 初始化一些参数
This commit is contained in:
@ -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()
|
||||
}
|
||||
|
Reference in New Issue
Block a user