config.go 834 B

123456789101112131415161718192021222324252627282930313233343536
  1. package config
  2. type Config struct {
  3. Server Server `mapstructure:"server"`
  4. Mysql Mysql `mapstructure:"mysql"`
  5. Jwt Jwt `mapstructure:"jwt"`
  6. Upload Upload `mapstructure:"upload"`
  7. Websocket Websocket `mapstructure:"websocket"`
  8. }
  9. // Server 服务启动端口配置
  10. type Server struct {
  11. Port string `mapstructure:"port"`
  12. }
  13. // Mysql 数据源配置
  14. type Mysql struct {
  15. UserName string `mapstructure:"username"`
  16. Password string `mapstructure:"password"`
  17. Url string `mapstructure:"url"`
  18. }
  19. // Jwt 用户认证配置
  20. type Jwt struct {
  21. SigningKey string `mapstructure:"signingKey"`
  22. }
  23. // 文件上传相关路径配置
  24. type Upload struct {
  25. SavePath string `mapstructer:"savePath"`
  26. AccessUrl string `mapstructure:"accessUrl"`
  27. }
  28. type Websocket struct {
  29. WSUrl string `mapstructure:"ws-url"`
  30. }