config.go 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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 AliPartNode struct {
  41. AesKey string
  42. }
  43. type WxNode struct {
  44. AppletAppId string
  45. AppletAppSecret string
  46. AppletNotifyUrl string
  47. AppletMchId string
  48. AppletAppKey string
  49. PublicAppId string
  50. PublicAppSecret string
  51. PublicMsgTmpId string
  52. }
  53. type ThirdPartyConfig struct {
  54. Ali AliPartNode
  55. Wx WxNode
  56. }
  57. type RPCNode struct {
  58. ServiceName string
  59. ServicePort int
  60. ServiceIp string
  61. MysqlDb string
  62. RedisDb int
  63. LogLevel string
  64. LogStacktrace bool
  65. }
  66. type KeepaliveConfig struct {
  67. ClientTime int
  68. ClientTimeout int
  69. ServerTime int
  70. ServerTimeout int
  71. ServerMiniTime int
  72. }
  73. type OssConfig struct {
  74. BrandImage string
  75. SeriesImage string
  76. AccessKeyId string
  77. AccessKeySecret string
  78. Endpoint string
  79. Bucket string
  80. AvatarBucket string
  81. IconBucket string
  82. }
  83. type Coupon struct {
  84. Url string
  85. Action string
  86. ExpireDate string
  87. }
  88. type RPCConfig struct {
  89. Prefix string
  90. Keepalive KeepaliveConfig
  91. PropertyTask RPCNode
  92. System RPCNode
  93. Garden RPCNode
  94. Thirdparty RPCNode
  95. }
  96. type Configure struct {
  97. // 基础配置
  98. K8s bool
  99. RunMode string
  100. Log LogConfig
  101. EtcdAddrs []string
  102. // 按需配置
  103. Mysql MysqlConfig
  104. Redis RedisConfig
  105. Elastic ElasticConfig
  106. ThirdParty ThirdPartyConfig
  107. Oss OssConfig
  108. // 所要启用的服务
  109. Rpc RPCConfig
  110. }