config.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 RPCNode struct {
  52. ServiceName string
  53. ServicePort int
  54. ServiceIp string
  55. MysqlDb string
  56. RedisDb int
  57. LogLevel string
  58. LogStacktrace bool
  59. }
  60. type KeepaliveConfig struct {
  61. ClientTime int
  62. ClientTimeout int
  63. ServerTime int
  64. ServerTimeout int
  65. ServerMiniTime int
  66. }
  67. type RPCConfig struct {
  68. Keepalive KeepaliveConfig
  69. SmartThirdParty RPCNode
  70. SmartGovernmentManagement RPCNode
  71. SmartLog RPCNode
  72. }
  73. type OssConfig struct {
  74. Protocol string
  75. Endpoint string
  76. Id string
  77. Key string
  78. GovernmentBucket string
  79. }
  80. type Configure struct {
  81. // 基础配置
  82. K8s bool
  83. GovernmentMailCheckUrl string
  84. RunMode string
  85. Log LogConfig
  86. Jwt JwtConfig
  87. MapUrl string
  88. // 按需配置
  89. Mysql MysqlConfig
  90. Redis RedisConfig
  91. Elastic ElasticConfig
  92. // 所要启用的服务
  93. SmartGovernmentManagementGateway GatewayConfig
  94. Rpc RPCConfig
  95. Oss OssConfig
  96. CityAreaCode string
  97. CityCode string
  98. }