config.go 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. BrandImage string
  64. SeriesImage string
  65. AccessKeyId string
  66. AccessKeySecret string
  67. Endpoint string
  68. Bucket string
  69. AvatarBucket string
  70. IconBucket string
  71. }
  72. type Coupon struct {
  73. Url string
  74. Action string
  75. ExpireDate string
  76. }
  77. type RPCConfig struct {
  78. Prefix string
  79. Keepalive KeepaliveConfig
  80. Mqtt RPCNode
  81. Device RPCNode
  82. }
  83. type InfluxdbConfig struct {
  84. Addr string
  85. Username string
  86. Password string
  87. }
  88. type MqttConfig struct {
  89. Addr string
  90. Username string
  91. Password string
  92. }
  93. type Configure struct {
  94. // 基础配置
  95. K8s bool
  96. EtcdAddrs []string
  97. RunMode string
  98. Log LogConfig
  99. // 按需配置
  100. Mysql MysqlConfig
  101. Redis RedisConfig
  102. Elastic ElasticConfig
  103. Influxdb InfluxdbConfig
  104. ThirdParty ThirdPartyConfig
  105. Oss OssConfig
  106. Mqtt MqttConfig
  107. // 所要启用的服务
  108. Rpc RPCConfig
  109. GateKey string
  110. DeviceManufactor []string
  111. DeviceProtocol []string
  112. }