config.go 2.1 KB

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