You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
866 B
44 lines
866 B
package initialize
|
|
|
|
import (
|
|
"github.com/gogf/gf/v2/os/gcfg"
|
|
"github.com/gogf/gf/v2/os/gctx"
|
|
"go.uber.org/zap"
|
|
"tgk-touch/internal/core"
|
|
g "tgk-touch/internal/global"
|
|
"tgk-touch/internal/model/config"
|
|
"tgk-touch/internal/module/adl400TtyApi"
|
|
m9zTtyApi "tgk-touch/internal/module/m9zTtyApi"
|
|
"tgk-touch/internal/module/m9zTtyPwd"
|
|
)
|
|
|
|
func Init() {
|
|
CfgInit()
|
|
ZapInit()
|
|
m9zTtyPwd.Init()
|
|
m9zTtyApi.Init()
|
|
adl400TtyApi.Init()
|
|
timer()
|
|
|
|
}
|
|
|
|
func CfgInit() {
|
|
|
|
// 读取配置文件
|
|
loader := gcfg.NewLoader[config.AppConfig](g.Cfg(), "")
|
|
// 设置配置变更回调
|
|
loader.OnChange(func(updated config.AppConfig) error {
|
|
g.GVA_Config = updated
|
|
ZapInit()
|
|
return nil
|
|
})
|
|
loader.MustLoadAndWatch(gctx.New(), "app-config")
|
|
g.GVA_Config = loader.Get()
|
|
|
|
}
|
|
func ZapInit() {
|
|
// 初始化zap日志库
|
|
g.GVA_LOG = core.Zap()
|
|
zap.ReplaceGlobals(g.GVA_LOG)
|
|
}
|