config.go 1.5 KB

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