智盟项目
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.

преди 1 година
преди 1 година
преди 1 година
преди 1 година
преди 1 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package main
  2. import (
  3. "fmt"
  4. "os"
  5. "os/signal"
  6. "syscall"
  7. "applet/app/cfg"
  8. "applet/app/db"
  9. "applet/app/task"
  10. "applet/app/utils"
  11. "applet/app/utils/logx"
  12. )
  13. func init() {
  14. // 加载任务配置
  15. cfg.InitTaskCfg()
  16. // 日志配置
  17. cfg.InitLog()
  18. // 初始化redis
  19. cfg.InitCache()
  20. cfg.InitEs() //ElasticSearch初始化
  21. baseDb := *cfg.DB
  22. baseDb.Path = fmt.Sprintf(cfg.DB.Path, cfg.DB.Name)
  23. if err := db.InitDB(&baseDb); err != nil {
  24. panic(err)
  25. }
  26. if err := db.InitZhimengDB(cfg.ZhimengDB); err != nil {
  27. panic(err)
  28. }
  29. utils.CurlDebug = true
  30. //cfg.InitMemCache()
  31. }
  32. func main() {
  33. go func() {
  34. // 初始化jobs方法列表、添加reload方法定时更新任务
  35. task.Init()
  36. task.Run()
  37. }()
  38. // graceful shutdown
  39. quit := make(chan os.Signal)
  40. signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
  41. <-quit
  42. _ = logx.Info("Server exiting...")
  43. }