From 74f675b955abcdadaa556c87fe3ec834c487271b Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期四, 14 十一月 2019 15:59:02 +0800
Subject: [PATCH] fix ret
---
extend/config/config.go | 79 ++++++++++++++++-----------------------
1 files changed, 33 insertions(+), 46 deletions(-)
diff --git a/extend/config/config.go b/extend/config/config.go
index df3e1d6..2ab67ab 100644
--- a/extend/config/config.go
+++ b/extend/config/config.go
@@ -1,51 +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{}
-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"`
+ Shards string `mapstructure:"shards"`
+ EsIndex esindexlist `mapstructure:"index"`
}
type esindexlist struct {
@@ -60,7 +51,7 @@
}
type sopath struct {
- Ip string `mapstructure:"ip"`
+ Ip string `mapstructure:"ip"`
Port string `mapstructure:"port"`
}
@@ -68,21 +59,19 @@
var EsInfo = &esinfo{}
-var DBconf = &database{}
-
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{}
@@ -104,10 +93,8 @@
}
viper.UnmarshalKey("es", EsInfo)
viper.UnmarshalKey("server", Server)
- viper.UnmarshalKey("database", DBconf)
- viper.UnmarshalKey("weedfs", WeedFs)
- viper.UnmarshalKey("sopath",SoPath)
+ viper.UnmarshalKey("sopath", SoPath)
viper.UnmarshalKey("facedetect", FaceDetectSet)
- viper.UnmarshalKey("dbpersoncompare",DbPersonCompInfo)
+ viper.UnmarshalKey("dbpersoncompare", DbPersonCompInfo)
viper.UnmarshalKey("espersoncompare", EsCompServerInfo)
}
--
Gitblit v1.8.0