config.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 GatewayConfig struct {
  36. AppKey string
  37. AppSecret string
  38. ServiceName string
  39. ServiceIp string
  40. ServicePort int
  41. MysqlDb string
  42. RedisDb int
  43. LogLevel string
  44. LogStacktrace bool
  45. }
  46. type RPCNode struct {
  47. ServiceName string
  48. ServicePort int
  49. ServiceIp string
  50. MysqlDb string
  51. RedisDb int
  52. LogLevel string
  53. LogStacktrace bool
  54. }
  55. type KeepaliveConfig struct {
  56. ClientTime int
  57. ClientTimeout int
  58. ServerTime int
  59. ServerTimeout int
  60. ServerMiniTime int
  61. }
  62. type RPCConfig struct {
  63. Prefix string
  64. Keepalive KeepaliveConfig
  65. ADMData RPCNode
  66. }
  67. type Configure struct {
  68. // 基础配置
  69. K8s bool
  70. RunMode string
  71. Log LogConfig
  72. // 按需配置
  73. Mysql MysqlConfig
  74. Redis RedisConfig
  75. Elastic ElasticConfig
  76. // 所要启用的服务
  77. ADMDataGateway GatewayConfig
  78. Rpc RPCConfig
  79. }