config.go 1.3 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. Mysql string
  9. Redis *RedisConfig
  10. Mongodb *mgoConf
  11. SurvivalTime int
  12. SaveConcurrency int // 消息保存并发数
  13. WxTmplConfig WxTmplMsg `json:"WxTmplConfig"`
  14. }
  15. type RedisConfig struct {
  16. Host string
  17. Addr string
  18. Modules string
  19. }
  20. type mysqlConfig struct {
  21. DbName string
  22. Address string
  23. UserName string
  24. PassWord string
  25. MaxOpenConns int
  26. MaxIdleConns int
  27. }
  28. type mgoConf struct {
  29. Address string
  30. Size int
  31. DbName string
  32. ReplSet string
  33. UserName string
  34. Password string
  35. Collection string
  36. Collection_back string
  37. }
  38. var ConfigJson Config
  39. type WxTmplMsg struct {
  40. RpcAddr string `json:"rpcAddr"`
  41. TmplSetting struct {
  42. JySchool string `json:"jySchool"`
  43. System string `json:"system"`
  44. CloseNotice string `json:"closeNotice"`
  45. } `json:"tmplSetting"`
  46. Limit struct {
  47. Total int `json:"total"`
  48. PrivateMessage struct {
  49. OneDayLimit int `json:"oneDayLimit"`
  50. DuringMine int `json:"duringMine"`
  51. } `json:"privateMessage"`
  52. Alert struct {
  53. Nums []int `json:"nums"`
  54. Mail []string `json:"mail"`
  55. } `json:"alert"`
  56. } `json:"limit"`
  57. }