config.go 699 B

12345678910111213141516171819202122232425262728293031
  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. // Config 配置结构体
  23. type Config struct {
  24. Server ServerConfig `yaml:"server"`
  25. MySQL MySQLConfig `yaml:"mysql"`
  26. JWT JWTConfig `yaml:"jwt"`
  27. }