config.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package config
  2. import (
  3. "github.com/zeromicro/go-zero/zrpc"
  4. )
  5. type Config struct {
  6. zrpc.RpcServerConf
  7. DataSource *mysqlConfig // 手动代码
  8. BaseSource *mysqlConfig // 手动代码
  9. WebRpcPort int
  10. Mysql string
  11. RedisAddr string `json:"RedisAddr"`
  12. Mongodb *mgoConf
  13. SurvivalTime int
  14. SaveConcurrency int // 消息保存并发数
  15. WxWebdomain string `json:"WxWebdomain"`
  16. WxTmplConfig WxTmplMsg `json:"WxTmplConfig"`
  17. Mail []struct {
  18. Addr string `json:"addr"`
  19. Port int `json:"port"`
  20. Pwd string `json:"pwd"`
  21. User string `json:"user"`
  22. } `json:"mail"`
  23. TidbEng string `json:"Tidb"`
  24. }
  25. type mysqlConfig struct {
  26. DbName string
  27. Address string
  28. UserName string
  29. PassWord string
  30. MaxOpenConns int
  31. MaxIdleConns int
  32. }
  33. type mgoConf struct {
  34. Address string
  35. Size int
  36. DbName string
  37. ReplSet string
  38. UserName string
  39. Password string
  40. Collection string
  41. Collection_back string
  42. }
  43. var ConfigJson Config
  44. type WxTmplMsg struct {
  45. RpcAddr string `json:"rpcAddr"`
  46. CloseNotice string `json:"closeNotice"`
  47. Limit struct {
  48. Total int `json:"total"`
  49. OneDayLimit int `json:"oneDayLimit"`
  50. DuringMine int `json:"duringMine"`
  51. Alert struct {
  52. Nums []int64 `json:"nums"`
  53. ToMail []string `json:"toMail"`
  54. CcMail []string `json:"ccMail"`
  55. } `json:"alert"`
  56. } `json:"limit"`
  57. }