config.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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 RedisConfig struct {
  23. Addrs []string
  24. Password string
  25. DB int
  26. PoolSize int
  27. MinIdleConns int
  28. MaxRetries int
  29. Cluster bool
  30. }
  31. type ElasticConfig struct {
  32. Addrs []string
  33. Sniff bool
  34. }
  35. type ThirdPartNode struct {
  36. Host string
  37. AppKey string
  38. AppSecret string
  39. }
  40. type AliPartNode struct {
  41. AesKey string
  42. }
  43. type WxNode struct {
  44. AppletAppId string
  45. AppletPagepath string
  46. AppletAppSecret string
  47. AppletNotifyUrl string
  48. AppletMchId string
  49. AppletAppKey string
  50. PublicToken string
  51. PublicAppId string
  52. PublicAppSecret string
  53. MerchantMchID string
  54. MerchantMchCertificateSerialNumber string
  55. MerchantMchAPIv3Key string
  56. MerchantMchPrivateKey string
  57. }
  58. type ThirdPartyConfig struct {
  59. Ali AliPartNode
  60. Wx WxNode
  61. }
  62. type RPCNode struct {
  63. ServiceName string
  64. ServicePort int
  65. ServiceIp string
  66. MysqlDb string
  67. RedisDb int
  68. LogLevel string
  69. LogStacktrace bool
  70. }
  71. type KeepaliveConfig struct {
  72. ClientTime int
  73. ClientTimeout int
  74. ServerTime int
  75. ServerTimeout int
  76. ServerMiniTime int
  77. }
  78. type OssConfig struct {
  79. Protocol string
  80. Endpoint string
  81. Id string
  82. Key string
  83. PropertyCompanyBucket string
  84. }
  85. type Coupon struct {
  86. Url string
  87. Action string
  88. ExpireDate string
  89. }
  90. type RPCConfig struct {
  91. Prefix string
  92. Keepalive KeepaliveConfig
  93. Garden RPCNode
  94. Household RPCNode
  95. }
  96. type GatewayConfig struct {
  97. AppKey string
  98. AppSecret string
  99. ServiceName string
  100. ServiceIp string
  101. ServicePort int
  102. MysqlDb string
  103. RedisDb int
  104. LogLevel string
  105. LogStacktrace bool
  106. }
  107. type JwtConfig struct {
  108. Secret string // 密钥
  109. Issuer string // 发行人
  110. Seconds int64 // 过期秒数
  111. }
  112. type Configure struct {
  113. // 基础配置
  114. K8s bool
  115. EtcdAddrs []string
  116. RunMode string
  117. Log LogConfig
  118. // 按需配置
  119. Mysql MysqlConfig
  120. Redis RedisConfig
  121. Elastic ElasticConfig
  122. ThirdParty ThirdPartyConfig
  123. Oss OssConfig
  124. Jwt JwtConfig
  125. // 所要启用的服务
  126. Rpc RPCConfig
  127. PropertyCallbackGateway GatewayConfig
  128. PayTest bool
  129. }