config.go 1.3 KB

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