config.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. // Copyright 2019 getensh.com. All rights reserved.
  2. // Use of this source code is governed by getensh.com.
  3. package config
  4. type LogConfig struct {
  5. Path string
  6. Level string
  7. MaxSize int
  8. MaxBackups int
  9. MaxAge int
  10. Stacktrace bool
  11. }
  12. type MysqlConfig struct {
  13. User string
  14. Password string
  15. Addr string
  16. DB string
  17. Charset string
  18. MaxIdle int
  19. MaxConn int
  20. LogMode bool
  21. }
  22. type MgoConfig struct {
  23. User string
  24. Password string
  25. Addr string
  26. }
  27. type RedisConfig struct {
  28. Addrs []string
  29. Password string
  30. DB int
  31. PoolSize int
  32. MinIdleConns int
  33. MaxRetries int
  34. Cluster bool
  35. }
  36. type ElasticConfig struct {
  37. Addrs []string
  38. Sniff bool
  39. }
  40. type ThirdPartNode struct {
  41. Host string
  42. AppKey string
  43. AppSecret string
  44. }
  45. type AliPartNode struct {
  46. AesKey string
  47. }
  48. type WxNode struct {
  49. AppletAppId string
  50. AppletAppSecret string
  51. AppletNotifyUrl string
  52. AppletMchId string
  53. AppletAppKey string
  54. PublicAppId string
  55. PublicAppSecret string
  56. PublicMsgTmpId string
  57. PublicStateMsgTmpId string
  58. }
  59. type ThirdPartyConfig struct {
  60. Ali AliPartNode
  61. Wx WxNode
  62. }
  63. type RPCNode struct {
  64. ServiceName string
  65. ServicePort int
  66. ServiceIp string
  67. MysqlDb string
  68. RedisDb int
  69. LogLevel string
  70. LogStacktrace bool
  71. }
  72. type KeepaliveConfig struct {
  73. ClientTime int
  74. ClientTimeout int
  75. ServerTime int
  76. ServerTimeout int
  77. ServerMiniTime int
  78. }
  79. type OssConfig struct {
  80. BrandImage string
  81. SeriesImage string
  82. AccessKeyId string
  83. AccessKeySecret string
  84. Endpoint string
  85. Bucket string
  86. AvatarBucket string
  87. IconBucket string
  88. FixBucket string
  89. Protocol string
  90. RentObj string
  91. VoteObj string
  92. EventObj string
  93. BrandBucket string
  94. }
  95. type Coupon struct {
  96. Url string
  97. Action string
  98. ExpireDate string
  99. }
  100. type RPCConfig struct {
  101. Prefix string
  102. Keepalive KeepaliveConfig
  103. Garden RPCNode
  104. Common RPCNode
  105. System RPCNode
  106. Household RPCNode
  107. Charge RPCNode
  108. Thirdparty RPCNode
  109. Company RPCNode
  110. Device RPCNode
  111. }
  112. type Configure struct {
  113. // 基础配置
  114. K8s bool
  115. RunMode string
  116. Log LogConfig
  117. // 按需配置
  118. Mysql MysqlConfig
  119. Redis RedisConfig
  120. Mgo MgoConfig
  121. Elastic ElasticConfig
  122. ThirdParty ThirdPartyConfig
  123. Oss OssConfig
  124. // 所要启用的服务
  125. Rpc RPCConfig
  126. EtcdAddrs []string
  127. }