sunty
2019-11-01 712ef81c6b8813a498a66cf61ffcd37e5c502c8c
extend/config/config.go
@@ -1,35 +1,42 @@
package config
import (
   "github.com/spf13/viper"
   "log"
   "github.com/spf13/viper"
)
type threshold struct {
   Value int    `mapstructure: "value"`
   Color string `mapstructure: "color"`
}
type server struct {
   Runmode   string `mapstructure: "runmode"`
   JwtSecret string `mapstructure: "jwtSecret"`
   JwtExpire string `mapstructure: "jwtExpire"`
   Url       string `mapstructure: "url"`
   AnalyServerId string `mapstructure: "analyServerId"`
   ImageUrl  string `mapstructure: "imageUrl"`
   PublicDomain string `mapstructure: "publicDomain"`
   Runmode        string `mapstructure: "runmode"`
   JwtSecret      string `mapstructure: "jwtSecret"`
   JwtExpire      string `mapstructure: "jwtExpire"`
   Url            string `mapstructure: "url"`
   AnalyServerId  string `mapstructure: "analyServerId"`
   NetworkAdapter string `mapstructure: "networkAdapter"`
   DeviceNum string `mapstructure: "deviceNum"` //设备编号
   DeviceType string `mapstructure: "deviceType"`  //设备型号
   DeviceSerialNum string `mapstructure: "deviceSerialNum"`  //设备序列号
   MasterVersion string `mapstructure: "masterVersion"` //主控版本
   WebVersion string `mapstructure: "webVersion"`  //web版本
   ChannelCount string `mapstructure: "channelCount"`  //通道个数
   DiskCount string `mapstructure: "diskCount"`  //硬盘个数
   DeviceNum       string `mapstructure: "deviceNum"`       //设备编号
   DeviceType      string `mapstructure: "deviceType"`      //设备型号
   DeviceSerialNum string `mapstructure: "deviceSerialNum"` //设备序列号
   MasterVersion   string `mapstructure: "masterVersion"`   //主控版本
   WebVersion      string `mapstructure: "webVersion"`      //web版本
   ChannelCount    string `mapstructure: "channelCount"`    //通道个数
   DiskCount       string `mapstructure: "diskCount"`       //硬盘个数
   SudoPassword  string      `mapstructure: "sudoPassword"` //系统密码
   SysThresholds []threshold `mapstructure: "sysThresholds"`
   PTZSpeed      int         `mapstructure: "ptzSpeed"` // 云台移动速度
}
var Server = &server{}
// wp add es 索引 以及 IP port
type esinfo struct {
   Shards string       `mapstructure:"shards"`
   EsIndex  esindexlist `mapstructure:"index"`
   Shards  string      `mapstructure:"shards"`
   EsIndex esindexlist `mapstructure:"index"`
}
type esindexlist struct {
@@ -44,7 +51,7 @@
}
type sopath struct {
   Ip string `mapstructure:"ip"`
   Ip   string `mapstructure:"ip"`
   Port string `mapstructure:"port"`
}
@@ -53,18 +60,18 @@
var EsInfo = &esinfo{}
type facedetect struct {
   Ip string `mapstructure:"Ip"`
   Port int `mapstructure:"port"`
   Ip   string `mapstructure:"Ip"`
   Port int    `mapstructure:"port"`
}
type dbpersoncompare struct {
   Ip string `mapstructure:"ip"`
   Port int `mapstructure:"port"`
   Ip   string `mapstructure:"ip"`
   Port int    `mapstructure:"port"`
}
type espersoncompare struct {
   Port int `mapstructure:"port"`
   Ips []string `mapstructure:"ips"`
   Port int      `mapstructure:"port"`
   Ips  []string `mapstructure:"ips"`
}
var DbPersonCompInfo = &dbpersoncompare{}
@@ -86,8 +93,8 @@
   }
   viper.UnmarshalKey("es", EsInfo)
   viper.UnmarshalKey("server", Server)
   viper.UnmarshalKey("sopath",SoPath)
   viper.UnmarshalKey("sopath", SoPath)
   viper.UnmarshalKey("facedetect", FaceDetectSet)
   viper.UnmarshalKey("dbpersoncompare",DbPersonCompInfo)
   viper.UnmarshalKey("dbpersoncompare", DbPersonCompInfo)
   viper.UnmarshalKey("espersoncompare", EsCompServerInfo)
}