config.go 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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 JwtConfig struct {
  36. Secret string // 密钥
  37. Issuer string // 发行人
  38. Seconds int64 // 过期秒数
  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. Prefix string
  69. Keepalive KeepaliveConfig
  70. ADMVehicleStyle RPCNode
  71. AdmManagement RPCNode
  72. }
  73. type EtcdConfig struct {
  74. Addrs []string
  75. }
  76. type OssConfig struct {
  77. AccessKey string
  78. AccessSecret string
  79. Bucket string
  80. EndPoint string
  81. DefaultBrandImage string
  82. BrandImage string
  83. DefaultSeriesImage string
  84. SeriesImage string
  85. }
  86. type Configure struct {
  87. // 基础配置
  88. K8s bool
  89. RunMode string
  90. Log LogConfig
  91. Jwt JwtConfig
  92. // 按需配置
  93. Mysql MysqlConfig
  94. Redis RedisConfig
  95. Elastic ElasticConfig
  96. // 所要启用的服务
  97. ADMGateway GatewayConfig
  98. Rpc RPCConfig
  99. Etcd EtcdConfig
  100. // oss
  101. Oss OssConfig
  102. }