1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package util
- import (
- "github.com/sirupsen/logrus"
- "gopkg.in/yaml.v3"
- "lc-smartX/lc/model"
- "os"
- )
- var Config = func() config {
- var conf config
- file, err := os.ReadFile("./config.yaml")
- if err != nil {
- logrus.Fatal("配置文件读取失败! error:", err)
- }
- err = yaml.Unmarshal(file, &conf)
- if err != nil {
- logrus.Fatal("配置文件解析失败! error:", err)
- }
- return conf
- }()
- type config struct {
- LedServerAddr string `yaml:"ledServerAddr"`
- HikServer hikServer `yaml:"hikServer"`
- Cameras []model.CameraInfo `yaml:"cameras"`
- OutputDevices []OutputDevice `yaml:"outputDevices"`
- }
- type hikServer struct {
- Addr string `yaml:"addr"`
- Path string `yaml:"path"`
- }
- type OutputDevice struct {
- Name string `yaml:"name"`
- ScreenIp string `yaml:"screen_ip"`
- ScreenPort string `yaml:"screen_port"`
- LoudspeakerIp string `yaml:"loudspeaker_ip"`
- Branch byte `yaml:"branch"`
- }
|