广告涉及的mq都放这里
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

47 rindas
757 B

  1. package cfg
  2. import (
  3. "flag"
  4. "io/ioutil"
  5. "gopkg.in/yaml.v2"
  6. mc "applet/app/utils/cache/cache"
  7. "applet/app/utils/logx"
  8. )
  9. func InitTaskCfg() {
  10. path := flag.String("c", "etc/task.yml", "config file")
  11. flag.Parse()
  12. var (
  13. c []byte
  14. err error
  15. conf *Config
  16. )
  17. if c, err = ioutil.ReadFile(*path); err != nil {
  18. panic(err)
  19. }
  20. if err = yaml.Unmarshal(c, &conf); err != nil {
  21. panic(err)
  22. }
  23. Prd = conf.Prd
  24. Debug = conf.Debug
  25. DB = &conf.DB
  26. DataDB = &conf.DataDB
  27. Log = &conf.Log
  28. Admin = &conf.Admin
  29. RedisAddr = conf.RedisAddr
  30. Local = conf.Local
  31. AppComm = &conf.AppComm
  32. }
  33. var MemCache mc.Cache
  34. func InitMemCache() {
  35. var err error
  36. MemCache, err = mc.NewCache("memory", `{"interval":60}`)
  37. if err != nil {
  38. logx.Fatal(err.Error())
  39. }
  40. }