liuxiaolong
2020-06-05 7c811247ecf143e08c576986a884bedadc57dd66
extend/config/config.go
@@ -11,6 +11,7 @@
   Color string `mapstructure: "color"`
}
type server struct {
    ServerName     string `mapstructure: "serverName"`
   Runmode        string `mapstructure: "runmode"`
   JwtSecret      string `mapstructure: "jwtSecret"`
   JwtExpire      string `mapstructure: "jwtExpire"`
@@ -29,6 +30,8 @@
   SudoPassword  string      `mapstructure: "sudoPassword"` //系统密码
   SysThresholds []threshold `mapstructure: "sysThresholds"`
   PTZSpeed      int         `mapstructure: "ptzSpeed"` // 云台移动速度
   PatchPath     string      `mapstructure:"patchPath"` //系统更新包路径
   BakPath       string      `mapstructure:"bakPath"`   //系统更新包路径
}
var Server = &server{}
@@ -40,10 +43,7 @@
}
type esindexlist struct {
   VideoPersons   index `mapstructure:"videopersons"`
   DbTables       index `mapstructure:"dbtables"`
   Dbtablepersons index `mapstructure:"dbtablepersons"`
   Personaction   index `mapstructure:"personaction"`
   AiOcean index `mapstructure:"aiOcean"`
}
type index struct {
   IndexName string `mapstructure:"index"`
@@ -55,9 +55,16 @@
   Port string `mapstructure:"port"`
}
type elastic struct {
   IndexName string `mapstructure: "indexName"`
   IndexType string `mapstructure: "indexType"`
}
var SoPath = &sopath{}
var EsInfo = &esinfo{}
var BasicFS = &elastic{}
type facedetect struct {
   Ip   string `mapstructure:"Ip"`
@@ -86,10 +93,10 @@
   var err error
   viper.SetConfigType("yaml")
   viper.SetConfigName(env)
   viper.AddConfigPath("/opt/vasystem/config/")
   viper.AddConfigPath("../config/")
   err = viper.ReadInConfig()
   if err != nil {
      log.Fatal("error on parsing configuration file")
      log.Fatal("error on parsing configuration file", err)
   }
   viper.UnmarshalKey("es", EsInfo)
   viper.UnmarshalKey("server", Server)
@@ -97,4 +104,5 @@
   viper.UnmarshalKey("facedetect", FaceDetectSet)
   viper.UnmarshalKey("dbpersoncompare", DbPersonCompInfo)
   viper.UnmarshalKey("espersoncompare", EsCompServerInfo)
   viper.UnmarshalKey("elastic.basicFS", BasicFS)
}