From 5d78b36e851a5862302f2e40c99a4477020c79bc Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期五, 20 九月 2019 13:46:52 +0800 Subject: [PATCH] 查找此人时先切图 --- extend/config/config.go | 57 +++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 45 insertions(+), 12 deletions(-) diff --git a/extend/config/config.go b/extend/config/config.go index 72db39f..801282d 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,18 +10,21 @@ 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"` } var Server = &server{} -type redis struct { - Host string `mapstructure:"host"` - Port int `mapstructure:"port"` - Password string `mapstructure:"password` - DBNum int `mapstructure:"db"` +type weedfs struct { + Ip string `mapstructure: "ip"` + UploadPort int `mapstructure: "uploadport"` + VisitPort int `mapstructure: "visitport"` } -var RedisConf = &redis{} +var WeedFs = &weedfs{} type database struct { Drive string `mapstructure:"drive"` @@ -34,6 +36,7 @@ type esinfo struct { Masterip string `mapstructure:"masterip"` Httpport string `mapstructure:"httpport"` + Shards string `mapstructure:"shards"` EsIndex esindexlist `mapstructure:"index"` } @@ -43,15 +46,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 facedetect struct { + Ip string `mapstructure:"Ip"` + Port int `mapstructure:"port"` +} + +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. @@ -59,14 +89,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("sopath",SoPath) + viper.UnmarshalKey("facedetect", FaceDetectSet) + viper.UnmarshalKey("dbpersoncompare",DbPersonCompInfo) + viper.UnmarshalKey("espersoncompare", EsCompServerInfo) } -- Gitblit v1.8.0