|
1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- package main
-
- import (
- "fmt"
- "os"
- "os/signal"
- "syscall"
-
- "applet/app/cfg"
- "applet/app/db"
- "applet/app/task"
- "applet/app/utils"
- "applet/app/utils/logx"
- )
-
- func init() {
-
- cfg.InitTaskCfg()
-
- cfg.InitLog()
- cfg.InitMq()
-
- cfg.InitCache()
- baseDb := *cfg.DB
- baseDb.Path = fmt.Sprintf(cfg.DB.Path, cfg.DB.Name)
- if err := db.InitDB(&baseDb); err != nil {
- panic(err)
- }
- utils.CurlDebug = true
-
- }
-
- func main() {
- go func() {
-
- task.Init()
- task.Run()
- }()
-
- quit := make(chan os.Signal)
- signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
- <-quit
- _ = logx.Info("Server exiting...")
- }
|