config.go 2.4 KB

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