feat: export setup
parent
56fbea1b6b
commit
ebf2951ea3
|
@ -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
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
Loading…
Reference in New Issue