config.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package config
  2. type Gateway struct {
  3. BaseUrl string `mapstructure:"baseUrl"`
  4. ScanUrl string `mapstructure:"scanUrl"`
  5. ScanSecond int64 `mapstructure:"scanSecond"`
  6. ConnUrl string `mapstructure:"connUrl"`
  7. NotifyUrl string `mapstructure:"notifyUrl"`
  8. WriteDataUrl string `mapstructure:"writeDataUrl"`
  9. StartCollectUrl string `mapstructure:"startCollectUrl"`
  10. OpenChannel string `mapstructure:"openChannel"`
  11. DisconnectUrl string `mapstructure:"disconnectUrl"`
  12. ConnectedUrl string `mapstructure:"connectedList"`
  13. }
  14. type Param struct {
  15. FirstOpen string `mapstructure:"firstOpen"`
  16. }
  17. type Config struct {
  18. Server Server `mapstructure:"server"`
  19. SQLite SQLite `mapstructure:"sqlite"`
  20. Jwt Jwt `mapstructure:"jwt"`
  21. Upload Upload `mapstructure:"upload"`
  22. Websocket Websocket `mapstructure:"websocket"`
  23. Gateway Gateway `mapstructure:"gateway"`
  24. Log2File Log2File `mapstructure:"log2file"`
  25. Param Param `mapstructure:"Param"`
  26. EmqConfig EmqConfig `mapstructure:"emq"`
  27. }
  28. // Server 服务启动端口配置
  29. type Server struct {
  30. Port string `mapstructure:"port"`
  31. }
  32. // SQLite Mysql 数据源配置
  33. type SQLite struct {
  34. Url string `mapstructure:"url"`
  35. }
  36. // Jwt 用户认证配置
  37. type Jwt struct {
  38. SigningKey string `mapstructure:"signingKey"`
  39. }
  40. // Upload 文件上传相关路径配置
  41. type Upload struct {
  42. SavePath string `mapstructure:"savePath"`
  43. AccessUrl string `mapstructure:"accessUrl"`
  44. }
  45. type Websocket struct {
  46. WSUrl string `mapstructure:"ws-url"`
  47. }
  48. type Log2File struct {
  49. FilePath string `mapstructure:"filePath"`
  50. FileName string `mapstructure:"FileName"`
  51. FileSuffix string `mapstructure:"FileSuffix"`
  52. }
  53. type EmqConfig struct {
  54. Protocol string `mapstructure:"protocol"`
  55. Port int `mapstructure:"port"`
  56. Topic []string `mapstructure:"topic"`
  57. UserName string `mapstructure:"userName"`
  58. Password string `mapstructure:"password"`
  59. ClientId string `mapstructure:"clientId"`
  60. Qos int `mapstructure:"qos"`
  61. Broker string `mapstructure:"broker"`
  62. Filter []string `mapstructure:"filter"`
  63. GatewayMac string `mapstructure:"gatewayMac"`
  64. FirstOpen string
  65. }