config.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. AppletAppSecret string
  46. AppletNotifyUrl string
  47. AppletMchId string
  48. AppletAppKey string
  49. PublicAppId string
  50. PublicAppSecret string
  51. MerchantMchID string
  52. MerchantMchCertificateSerialNumber string
  53. MerchantMchAPIv3Key string
  54. MerchantMchPrivateKey string
  55. }
  56. type ThirdPartyConfig struct {
  57. Ali AliPartNode
  58. Wx WxNode
  59. }
  60. type RPCNode struct {
  61. ServiceName string
  62. ServicePort int
  63. ServiceIp string
  64. MysqlDb string
  65. RedisDb int
  66. LogLevel string
  67. LogStacktrace bool
  68. }
  69. type KeepaliveConfig struct {
  70. ClientTime int
  71. ClientTimeout int
  72. ServerTime int
  73. ServerTimeout int
  74. ServerMiniTime int
  75. }
  76. type OssConfig struct {
  77. Protocol string
  78. Endpoint string
  79. Id string
  80. Key string
  81. PropertyCompanyBucket string
  82. BusinessAuthorizationLetterTempUrl string
  83. BankTempUrl string
  84. ProvinceTempUrl string
  85. }
  86. type Coupon struct {
  87. Url string
  88. Action string
  89. ExpireDate string
  90. }
  91. type RPCConfig struct {
  92. Prefix string
  93. Keepalive KeepaliveConfig
  94. Company RPCNode
  95. Garden RPCNode
  96. Common RPCNode
  97. System RPCNode
  98. PropertyLog RPCNode
  99. Thirdparty RPCNode
  100. }
  101. type GatewayConfig struct {
  102. AppKey string
  103. AppSecret string
  104. ServiceName string
  105. ServiceIp string
  106. ServicePort int
  107. MysqlDb string
  108. RedisDb int
  109. LogLevel string
  110. LogStacktrace bool
  111. }
  112. type JwtConfig struct {
  113. Secret string // 密钥
  114. Issuer string // 发行人
  115. Seconds int64 // 过期秒数
  116. }
  117. type Configure struct {
  118. // 基础配置
  119. K8s bool
  120. EtcdAddrs []string
  121. RunMode string
  122. Log LogConfig
  123. // 按需配置
  124. Mysql MysqlConfig
  125. Redis RedisConfig
  126. Elastic ElasticConfig
  127. ThirdParty ThirdPartyConfig
  128. Oss OssConfig
  129. Jwt JwtConfig
  130. // 所要启用的服务
  131. Rpc RPCConfig
  132. PropertyCompanyGateway GatewayConfig
  133. }