|
- package main
-
- import (
- "applet/app/cfg"
- "applet/app/utils"
- "applet/app/utils/logx"
- "applet/consume"
- db "code.fnuoos.com/zhimeng/model.git/src"
- "os"
- "os/signal"
- "syscall"
- )
-
- // 系统初始化
- func init() {
- cfg.InitCfg() //配置初始化
- cfg.InitMq() //配置
- cfg.InitLog() //日志初始化
- cfg.InitCache() //缓存初始化
- if cfg.Debug { //判断是否是debug
- if err := db.InitDB(cfg.DB); err != nil { //主数据库初始化
- panic(err)
- }
- channel := make(chan int, 0) //开辟管道,缓冲为
- go db.InitDBs(channel)
- <-channel
- }
- }
-
- func main() {
- if cfg.CurlDebug {
- utils.CurlDebug = true
- }
-
- go func() {
- // 初始化
- consume.Init()
- consume.Run()
- }()
-
- quit := make(chan os.Signal)
- signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
- <-quit
- _ = logx.Info("Server exiting...")
-
- }
|