From 7c811247ecf143e08c576986a884bedadc57dd66 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期五, 05 六月 2020 18:29:41 +0800 Subject: [PATCH] add refresh token to resp --- extend/config/config.go | 79 +++++++++++++++++++++++---------------- 1 files changed, 47 insertions(+), 32 deletions(-) diff --git a/extend/config/config.go b/extend/config/config.go index 5e9d97e..48af440 100644 --- a/extend/config/config.go +++ b/extend/config/config.go @@ -1,42 +1,49 @@ 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"` + ServerName string `mapstructure: "serverName"` + 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"` // 浜戝彴绉诲姩閫熷害 + PatchPath string `mapstructure:"patchPath"` //绯荤粺鏇存柊鍖呰矾寰� + BakPath string `mapstructure:"bakPath"` //绯荤粺鏇存柊鍖呰矾寰� } 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 { - 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"` @@ -44,27 +51,34 @@ } type sopath struct { - Ip string `mapstructure:"ip"` + Ip string `mapstructure:"ip"` 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"` - 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{} @@ -79,15 +93,16 @@ 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) - viper.UnmarshalKey("sopath",SoPath) + viper.UnmarshalKey("sopath", SoPath) viper.UnmarshalKey("facedetect", FaceDetectSet) - viper.UnmarshalKey("dbpersoncompare",DbPersonCompInfo) + viper.UnmarshalKey("dbpersoncompare", DbPersonCompInfo) viper.UnmarshalKey("espersoncompare", EsCompServerInfo) + viper.UnmarshalKey("elastic.basicFS", BasicFS) } -- Gitblit v1.8.0