|
- 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.InitCache()
- baseDb := *cfg.DB
- baseDb.Path = fmt.Sprintf(cfg.DB.Path, cfg.DB.Name)
- if err := db.InitDB(&baseDb); err != nil {
- panic(err)
- }
- baseImDb := *cfg.IMDB
- baseImDb.Path = fmt.Sprintf(cfg.IMDB.Path, cfg.IMDB.Name)
- if err := db.InitImDB(&baseImDb); 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...")
- }
|