config.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. // Copyright 2019 github.com. All rights reserved.
  2. // Use of this source code is governed by github.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 RongLianNode struct {
  41. City string
  42. RongLianSid string
  43. RongLianToken string
  44. RongLianServerIp string
  45. RongLianServerPort string
  46. RongLianSoftVersion string
  47. RongLianAppId string
  48. VcodeTemplateId int
  49. AlarmTemplateId int
  50. CompanyVerifyTemplateId int
  51. ProviderVerifyTemplateId int
  52. }
  53. type MojiNode struct {
  54. MojiAppCode string
  55. ConditionUrl string
  56. EnviromentUrl string
  57. ForecastUrl string
  58. DefaultProvince string
  59. DefaultRegion string
  60. }
  61. type ProvincialNode struct {
  62. Account string
  63. Password string
  64. AppKey string
  65. AppSecret string
  66. LoginApi string
  67. ProjectCodeApi string
  68. ProjectUploadApi string
  69. ProvincialVerifyApi string
  70. DustDeviceUploadApi string
  71. DustDataUploadApi string
  72. }
  73. type ThirdPartConfig struct {
  74. PartName ThirdPartNode
  75. RongLian RongLianNode
  76. Moji MojiNode
  77. Provincial ProvincialNode
  78. MailHost string
  79. MailUser string
  80. MailPass string
  81. }
  82. type RPCNode struct {
  83. ServiceName string
  84. ServicePort int
  85. ServiceIp string
  86. MysqlDb string
  87. RedisDb int
  88. LogLevel string
  89. LogStacktrace bool
  90. }
  91. type KeepaliveConfig struct {
  92. ClientTime int
  93. ClientTimeout int
  94. ServerTime int
  95. ServerTimeout int
  96. ServerMiniTime int
  97. }
  98. type RPCConfig struct {
  99. Keepalive KeepaliveConfig
  100. SmartProvincial RPCNode
  101. }
  102. type InfluxdbConfig struct {
  103. Addr string
  104. Username string
  105. Password string
  106. }
  107. type Configure struct {
  108. // 基础配置
  109. K8s bool
  110. RunMode string
  111. Log LogConfig
  112. EnterpriseUrl string
  113. SupplierUrl string
  114. // 按需配置
  115. Mysql MysqlConfig
  116. Redis RedisConfig
  117. Elastic ElasticConfig
  118. ThirdParty ThirdPartConfig
  119. Influxdb InfluxdbConfig
  120. // 所要启用的服务
  121. Rpc RPCConfig
  122. }