config.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. WxTmplConfig WxTmplMsg `json:"WxTmplConfig"`
  16. Mail []struct {
  17. Addr string `json:"addr"`
  18. Port int `json:"port"`
  19. Pwd string `json:"pwd"`
  20. User string `json:"user"`
  21. } `json:"mail"`
  22. TidbEng string `json:"Tidb"`
  23. }
  24. type mysqlConfig struct {
  25. DbName string
  26. Address string
  27. UserName string
  28. PassWord string
  29. MaxOpenConns int
  30. MaxIdleConns int
  31. }
  32. type mgoConf struct {
  33. Address string
  34. Size int
  35. DbName string
  36. ReplSet string
  37. UserName string
  38. Password string
  39. Collection string
  40. Collection_back string
  41. }
  42. var ConfigJson Config
  43. type WxTmplMsg struct {
  44. RpcAddr string `json:"rpcAddr"`
  45. CloseNotice string `json:"closeNotice"`
  46. Limit struct {
  47. Total int `json:"total"`
  48. OneDayLimit int `json:"oneDayLimit"`
  49. DuringMine int `json:"duringMine"`
  50. Alert struct {
  51. Nums []int64 `json:"nums"`
  52. ToMail []string `json:"toMail"`
  53. CcMail []string `json:"ccMail"`
  54. } `json:"alert"`
  55. } `json:"limit"`
  56. }