蛋蛋星球 后台端
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.

4 weken geleden
12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. baseDb := *cfg.DB
  21. baseDb.Path = fmt.Sprintf(cfg.DB.Path, cfg.DB.Name)
  22. if err := db.InitDB(&baseDb); err != nil {
  23. panic(err)
  24. }
  25. utils.CurlDebug = true
  26. //cfg.InitMemCache()
  27. }
  28. func main() {
  29. go func() {
  30. // 初始化jobs方法列表、添加reload方法定时更新任务
  31. task.Init()
  32. task.Run()
  33. }()
  34. // graceful shutdown
  35. quit := make(chan os.Signal)
  36. signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
  37. <-quit
  38. _ = logx.Info("Server exiting...")
  39. }