config.go 2.4 KB

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