liuxiaolong
2019-11-20 c070c02f3fcb8c2c8dfa1ffcadf72a4fb827a43a
extend/config/config.go
@@ -6,6 +6,10 @@
   "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"`
@@ -22,7 +26,9 @@
   ChannelCount    string `mapstructure: "channelCount"`    //通道个数
   DiskCount       string `mapstructure: "diskCount"`       //硬盘个数
   SysServerPort string `mapstructure: "SysServerPort"`
   SudoPassword  string      `mapstructure: "sudoPassword"` //系统密码
   SysThresholds []threshold `mapstructure: "sysThresholds"`
   PTZSpeed      int         `mapstructure: "ptzSpeed"` // 云台移动速度
}
var Server = &server{}
@@ -34,10 +40,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"`
@@ -83,7 +86,7 @@
   viper.AddConfigPath("/opt/vasystem/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)