config.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. SmartAuth RPCNode
  70. SmartAlarm RPCNode
  71. }
  72. type OssConfig struct {
  73. Protocol string
  74. UseSsl bool
  75. Endpoint string
  76. Id string
  77. Key string
  78. StaffBucket string
  79. }
  80. type Configure struct {
  81. // 基础配置
  82. K8s bool
  83. RunMode string
  84. Log LogConfig
  85. //Jwt JwtConfig
  86. // 按需配置
  87. Mysql MysqlConfig
  88. Redis RedisConfig
  89. //Elastic ElasticConfig
  90. // 所要启用的服务
  91. AccessControlMonitor GatewayConfig
  92. Rpc RPCConfig
  93. Oss OssConfig
  94. }