config.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 ThirdPartNode struct {
  36. Host string
  37. AppKey string
  38. AppSecret string
  39. }
  40. type ThirdPartConfig struct {
  41. PartName ThirdPartNode
  42. }
  43. type RPCNode struct {
  44. ServiceName string
  45. ServicePort int
  46. ServiceIp string
  47. MysqlDb string
  48. RedisDb int
  49. LogLevel string
  50. LogStacktrace bool
  51. }
  52. type KeepaliveConfig struct {
  53. ClientTime int
  54. ClientTimeout int
  55. ServerTime int
  56. ServerTimeout int
  57. ServerMiniTime int
  58. }
  59. type RPCConfig struct {
  60. Prefix string
  61. Keepalive KeepaliveConfig
  62. ADMVehicleStyle RPCNode
  63. ADMData RPCNode
  64. }
  65. type EtcdConfig struct {
  66. Addrs []string
  67. }
  68. type OssConfig struct {
  69. AccessKey string
  70. AccessSecret string
  71. Bucket string
  72. EndPoint string
  73. DefaultBrandImage string
  74. BrandImage string
  75. DefaultSeriesImage string
  76. SeriesImage string
  77. DownLoadBucket string
  78. }
  79. type Configure struct {
  80. // 基础配置
  81. K8s bool
  82. RunMode string
  83. Log LogConfig
  84. // 按需配置
  85. Mysql MysqlConfig
  86. Redis RedisConfig
  87. Elastic ElasticConfig
  88. ThirdPart ThirdPartConfig
  89. // 所要启用的服务
  90. Rpc RPCConfig
  91. // etcd
  92. Etcd EtcdConfig
  93. Oss OssConfig
  94. }