config.go 952 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package config
  2. // ServerConfig 服务器配置
  3. type ServerConfig struct {
  4. Port int `yaml:"port"`
  5. }
  6. // MySQLConfig MySQL数据库配置
  7. type MySQLConfig struct {
  8. Host string `yaml:"host"`
  9. Port int `yaml:"port"`
  10. Username string `yaml:"username"`
  11. Password string `yaml:"password"`
  12. Dbname string `yaml:"dbname"`
  13. Charset string `yaml:"charset"`
  14. ParseTime bool `yaml:"parseTime"`
  15. Loc string `yaml:"loc"`
  16. }
  17. // JWTConfig JWT配置
  18. type JWTConfig struct {
  19. Secret string `yaml:"secret"`
  20. Expire int `yaml:"expire"`
  21. }
  22. // RedisConfig Redis配置
  23. type RedisConfig struct {
  24. Host string `yaml:"host"`
  25. Port int `yaml:"port"`
  26. Password string `yaml:"password"`
  27. DB int `yaml:"db"`
  28. PoolSize int `yaml:"poolSize"`
  29. }
  30. // Config 配置结构体
  31. type Config struct {
  32. Server ServerConfig `yaml:"server"`
  33. MySQL MySQLConfig `yaml:"mysql"`
  34. JWT JWTConfig `yaml:"jwt"`
  35. Redis RedisConfig `yaml:"redis"`
  36. }