-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
40 lines (38 loc) · 1.16 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package Router2SystemInit
import (
"fmt"
CoreLog "github.com/fotomxq/weeekj_core/v5/core/log"
CoreReg "github.com/fotomxq/weeekj_core/v5/core/reg"
RouterGinSet "github.com/fotomxq/weeekj_core/v5/router/gin_set"
RouterSystem "github.com/fotomxq/weeekj_core/v5/router/system"
Router2SystemConfig "github.com/fotomxq/weeekj_core/v5/router2/system_config"
)
// Main 初始化程序设计
func Main() {
//初始化配置
if err := Router2SystemConfig.Init(); err != nil {
fmt.Println(err)
return
}
fmt.Println("main router core config init success.")
//初始化日志模块
logSaveDB, err := Router2SystemConfig.Cfg.Section("log").Key("log_save_db").Bool()
if err != nil {
logSaveDB = true
}
CoreLog.Init(Router2SystemConfig.Debug, AppName, logSaveDB)
fmt.Println("main router core log init success.")
//装载gin
RouterGinSet.Init()
//启动注册机
if OpenSystemReg {
//计算注册地址
CoreReg.Init(AppName + AppVersion)
//fmt.Println("reg: ", CoreReg.GetKey("245d5c2d6bedd03abe1d", "202301", "202512"))
//注册机启动
if b := RouterSystem.Reg(AppName + AppVersion); !b {
return
}
fmt.Println("main router system reg success.")
}
}