config.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package config
  2. import (
  3. "app.yhyue.com/moapp/jybase/common"
  4. qrpc "app.yhyue.com/moapp/message/model"
  5. "github.com/gogf/gf/v2/frame/g"
  6. "github.com/gogf/gf/v2/os/gcfg"
  7. )
  8. type config struct {
  9. Nsq struct {
  10. Address string
  11. }
  12. Redis struct {
  13. Address string
  14. }
  15. Mongodb struct {
  16. Address string
  17. Size int
  18. DbName string
  19. ReplSet string
  20. UserName string
  21. Password string
  22. }
  23. Etcd struct {
  24. Hosts []string
  25. Key string
  26. }
  27. DocPoints struct {
  28. AppId string
  29. Open struct {
  30. Max int64
  31. Jyweb_article_open int64
  32. Jydocs_doc_open int64
  33. }
  34. Jywx_subscribe_new int64
  35. Jywx_subscribe_invite int64
  36. Jywx_subscribe_invited int64
  37. }
  38. }
  39. var PushConfig *pushConfig
  40. type pushConfig struct {
  41. Webdomain string `json:"webdomain"`
  42. Weixinrpc string `json:"weixinrpc"`
  43. PushPoolSize int `json:"pushPoolSize"`
  44. WxMsg struct {
  45. Id string
  46. First *qrpc.TmplItem
  47. Keyword1 *qrpc.TmplItem
  48. Keyword2 *qrpc.TmplItem
  49. Keyword3 *qrpc.TmplItem
  50. Keyword4 *qrpc.TmplItem
  51. Remark *qrpc.TmplItem
  52. } `json:"wxTplMsg"`
  53. TestId string `json:"testId"`
  54. DelayedTime int `json:"delayedTime"`
  55. }
  56. //var Config *config
  57. func init() {
  58. //推送配置文件
  59. common.ReadConfig("./etc/push.json", &PushConfig)
  60. //系统配置文件
  61. //common.ReadConfig(&Config)
  62. g.Cfg().GetAdapter().(*gcfg.AdapterFile).SetFileName("./etc/config.yaml")
  63. }