feat: export setup

master
Evan Chen 2021-12-17 00:09:51 +08:00
parent 56fbea1b6b
commit ebf2951ea3
2 changed files with 4 additions and 4 deletions

View File

@ -43,10 +43,10 @@ func init() {
viper.SetEnvKeyReplacer(replacer) viper.SetEnvKeyReplacer(replacer)
viper.AutomaticEnv() viper.AutomaticEnv()
viper.SetConfigType("json") viper.SetConfigType("json")
setup() Setup()
} }
func setup() { func Setup() {
zerolog.TimeFieldFormat = zerolog.TimeFormatUnix zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
zerolog.DurationFieldInteger = true zerolog.DurationFieldInteger = true
zerolog.SetGlobalLevel(zerolog.Level(viper.GetInt("log.level"))) zerolog.SetGlobalLevel(zerolog.Level(viper.GetInt("log.level")))
@ -114,7 +114,7 @@ func ConfigRead(cfgFile string) {
if err := viper.ReadInConfig(); err != nil { if err := viper.ReadInConfig(); err != nil {
l.Error().Err(err).Msg("ReadInConfig error") l.Error().Err(err).Msg("ReadInConfig error")
} }
setup() Setup()
} }
// ConfigWrite write current config to file // ConfigWrite write current config to file

View File

@ -98,7 +98,7 @@ func New() *System {
} }
func (sys *System) Start() { func (sys *System) Start() {
// setup() // Setup()
sys.order() sys.order()
sys.status = sys_init sys.status = sys_init
go func() { go func() {