liuxiaolong
2019-09-27 3566c2630dc2ac33e03fb6df5ec2cd19e1625a68
extend/config/config.go
@@ -14,28 +14,20 @@
   ImageUrl  string `mapstructure: "imageUrl"`
   PublicDomain string `mapstructure: "publicDomain"`
   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"`  //硬盘个数
}
var Server = &server{}
type weedfs struct {
   Ip string `mapstructure: "ip"`
   UploadPort int `mapstructure: "uploadport"`
   VisitPort int `mapstructure: "visitport"`
}
var WeedFs = &weedfs{}
type database struct {
   Drive    string `mapstructure:"drive"`
   Name     string `mapstructure:"name"`
   FilePath string `mapstructure:"filepath"`
}
// wp add es 索引 以及 IP port
type esinfo struct {
   Masterip string      `mapstructure:"masterip"`
   Httpport string      `mapstructure:"httpport"`
   Shards string       `mapstructure:"shards"`
   EsIndex  esindexlist `mapstructure:"index"`
}
@@ -59,8 +51,6 @@
var SoPath = &sopath{}
var EsInfo = &esinfo{}
var DBconf = &database{}
type facedetect struct {
   Ip string `mapstructure:"Ip"`
@@ -90,15 +80,12 @@
   viper.SetConfigType("yaml")
   viper.SetConfigName(env)
   viper.AddConfigPath("/opt/vasystem/config/")
   viper.AddConfigPath("")
   err = viper.ReadInConfig()
   if err != nil {
      log.Fatal("error on parsing configuration file")
   }
   viper.UnmarshalKey("es", EsInfo)
   viper.UnmarshalKey("server", Server)
   viper.UnmarshalKey("database", DBconf)
   viper.UnmarshalKey("weedfs", WeedFs)
   viper.UnmarshalKey("sopath",SoPath)
   viper.UnmarshalKey("facedetect", FaceDetectSet)
   viper.UnmarshalKey("dbpersoncompare",DbPersonCompInfo)