From 5554c2b0ce78145c7932e94d1d9b8c00b2208ec6 Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期六, 21 九月 2019 14:25:41 +0800 Subject: [PATCH] token decrease --- extend/config/config.go | 59 ++++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 40 insertions(+), 19 deletions(-) diff --git a/extend/config/config.go b/extend/config/config.go index a4edba7..df3e1d6 100644 --- a/extend/config/config.go +++ b/extend/config/config.go @@ -1,9 +1,8 @@ package config import ( - "log" - "github.com/spf13/viper" + "log" ) type server struct { @@ -11,9 +10,18 @@ JwtSecret string `mapstructure: "jwtSecret"` JwtExpire string `mapstructure: "jwtExpire"` Url string `mapstructure: "url"` + AnalyServerId string `mapstructure: "analyServerId"` 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{} @@ -26,15 +34,6 @@ var WeedFs = &weedfs{} -type redis struct { - Host string `mapstructure:"host"` - Port int `mapstructure:"port"` - Password string `mapstructure:"password` - DBNum int `mapstructure:"db"` -} - -var RedisConf = &redis{} - type database struct { Drive string `mapstructure:"drive"` Name string `mapstructure:"name"` @@ -45,6 +44,7 @@ type esinfo struct { Masterip string `mapstructure:"masterip"` Httpport string `mapstructure:"httpport"` + Shards string `mapstructure:"shards"` EsIndex esindexlist `mapstructure:"index"` } @@ -54,22 +54,42 @@ Dbtablepersons index `mapstructure:"dbtablepersons"` Personaction index `mapstructure:"personaction"` } - type index struct { IndexName string `mapstructure:"index"` IndexType string `mapstructure:"type"` } +type sopath struct { + Ip string `mapstructure:"ip"` + Port string `mapstructure:"port"` +} + +var SoPath = &sopath{} + var EsInfo = &esinfo{} var DBconf = &database{} -type CompareServer struct { - Url []string `mapstructure:"url"` +type facedetect struct { + Ip string `mapstructure:"Ip"` + Port int `mapstructure:"port"` } -var CompServerInfo = &CompareServer{} +type dbpersoncompare struct { + Ip string `mapstructure:"ip"` + Port int `mapstructure:"port"` +} +type espersoncompare struct { + Port int `mapstructure:"port"` + Ips []string `mapstructure:"ips"` +} + +var DbPersonCompInfo = &dbpersoncompare{} + +var EsCompServerInfo = &espersoncompare{} + +var FaceDetectSet = &facedetect{} // Init is an exported method that takes the environment starts the viper // (external lib) and returns the configuration struct. @@ -77,16 +97,17 @@ var err error viper.SetConfigType("yaml") viper.SetConfigName(env) - viper.AddConfigPath("../config/") - viper.AddConfigPath("config/") + viper.AddConfigPath("/opt/vasystem/config/") err = viper.ReadInConfig() if err != nil { log.Fatal("error on parsing configuration file") } viper.UnmarshalKey("es", EsInfo) viper.UnmarshalKey("server", Server) - viper.UnmarshalKey("redis", RedisConf) viper.UnmarshalKey("database", DBconf) viper.UnmarshalKey("weedfs", WeedFs) - viper.UnmarshalKey("compare", CompServerInfo) + viper.UnmarshalKey("sopath",SoPath) + viper.UnmarshalKey("facedetect", FaceDetectSet) + viper.UnmarshalKey("dbpersoncompare",DbPersonCompInfo) + viper.UnmarshalKey("espersoncompare", EsCompServerInfo) } -- Gitblit v1.8.0