config.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 JwtConfig struct {
  13. Secret string // 密钥
  14. Issuer string // 发行人
  15. Seconds int64 // 过期秒数
  16. }
  17. type MysqlConfig struct {
  18. User string
  19. Password string
  20. Addr string
  21. DB string
  22. Charset string
  23. MaxIdle int
  24. MaxConn int
  25. LogMode bool
  26. }
  27. type RedisConfig struct {
  28. Addrs []string
  29. Password string
  30. DB int
  31. PoolSize int
  32. MinIdleConns int
  33. MaxRetries int
  34. Cluster bool
  35. }
  36. type ElasticConfig struct {
  37. Addrs []string
  38. Sniff bool
  39. }
  40. type GatewayConfig struct {
  41. AppKey string
  42. AppSecret string
  43. ServiceName string
  44. ServiceIp string
  45. ServicePort int
  46. MysqlDb string
  47. RedisDb int
  48. LogLevel string
  49. LogStacktrace bool
  50. }
  51. type ProvincialNode struct {
  52. Account string
  53. Password string
  54. AppKey string
  55. AppSecret string
  56. LoginApi string
  57. ProjectCodeApi string
  58. ProjectUploadApi string
  59. ProvincialVerifyApi string
  60. DustDeviceUploadApi string
  61. DustDataUploadApi string
  62. }
  63. type ThirdPartConfig struct {
  64. Provincial ProvincialNode
  65. }
  66. type RPCNode struct {
  67. ServiceName string
  68. ServicePort int
  69. ServiceIp string
  70. MysqlDb string
  71. RedisDb int
  72. LogLevel string
  73. LogStacktrace bool
  74. }
  75. type KeepaliveConfig struct {
  76. ClientTime int
  77. ClientTimeout int
  78. ServerTime int
  79. ServerTimeout int
  80. ServerMiniTime int
  81. }
  82. type RPCConfig struct {
  83. Keepalive KeepaliveConfig
  84. SmartAuth RPCNode
  85. SmartAlarm RPCNode
  86. SmartThirdparty RPCNode
  87. }
  88. type OssConfig struct {
  89. Protocol string
  90. UseSsl bool
  91. Endpoint string
  92. Id string
  93. Key string
  94. StaffBucket string
  95. }
  96. type Configure struct {
  97. // 基础配置
  98. K8s bool
  99. RunMode string
  100. Log LogConfig
  101. UseProvincial bool
  102. //Jwt JwtConfig
  103. // 按需配置
  104. Mysql MysqlConfig
  105. Redis RedisConfig
  106. //Elastic ElasticConfig
  107. // 所要启用的服务
  108. AccessControlMonitor GatewayConfig
  109. Rpc RPCConfig
  110. Oss OssConfig
  111. ThirdParty ThirdPartConfig
  112. }