-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathmain.go
More file actions
37 lines (32 loc) · 770 Bytes
/
main.go
File metadata and controls
37 lines (32 loc) · 770 Bytes
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
package main
import (
"MagicBox/cmd"
"MagicBox/utils"
"MagicBox/workerflow"
"os"
"github.com/tidwall/gjson"
)
func main() {
//初始化日志
utils.InitLogger()
//初始化配置
configRoot := "configs/"
utils.InitConfig(configRoot)
//接收外部传输参数
if len(os.Args) > 1 {
cmd.Execute()
return
}
//配置文件热更新
go workerflow.WatchConfigChanges(configRoot)
//初始化定时任务
utils.InitCronWorker()
utils.GLOBAL_LOGGER.Info("当前版本: 2.2.4")
//任务执行
for k, v := range utils.GLOBAL_WORKFLOW_MAP {
//使用gjson解析
cronExpression := gjson.Get(v, `drawflow.nodes.#(label=="trigger").data.triggers.#(type="cron-job").data.expression`)
workerflow.AddCronTask(cronExpression.String(), k)
}
select {}
}