From d671ea8ec8658da21990d5418c981d74f6015045 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期三, 11 十二月 2019 11:50:43 +0800
Subject: [PATCH] add conf path

---
 extend/config/config.go |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/extend/config/config.go b/extend/config/config.go
index 4251374..54b3bf9 100644
--- a/extend/config/config.go
+++ b/extend/config/config.go
@@ -11,27 +11,27 @@
 	ServerId string `mapstructure: "serverId"`
 	ServerIp string `mapstructure: "serverIp"`
 	VideoPort string   `mapstructure: "videoPort"`
-	NginxIp string  `mapstructure: "ngxIp"`
-	NginxPort string   `mapstructure: "ngxPort"`
+	NgxIp string  `mapstructure: "ngxIp"`
+	NgxPort string   `mapstructure: "ngxPort"`
 }
 
 var serverList = &server{}
 
 var ServerMap = make(map[string]string,0)
 var NgxMap = make(map[string]string,0)
-func Init(env string) {
+func Init(env string, configPath string) {
 	var err error
 	viper.SetConfigType("yaml")
 	viper.SetConfigName(env)
-	viper.AddConfigPath("./config/")
+	viper.AddConfigPath(configPath)
 	err = viper.ReadInConfig()
 	if err != nil {
-		log.Fatal("error on parsing configuration file")
+		log.Fatal("error on parsing configuration file",err)
 	}
 	viper.UnmarshalKey("server", serverList)
 	for _,s :=range *serverList {
 		si := s
 		ServerMap[si.ServerId] = "http://"+si.ServerIp+":"+si.VideoPort+"/getRecordVideoPath"
-		NgxMap[si.ServerId] = "http://"+si.NginxIp+":"+si.NginxPort+"/videosource"
+		NgxMap[si.ServerId] = "http://"+si.NgxIp+":"+si.NgxPort+"/videosource"
 	}
 }
\ No newline at end of file

--
Gitblit v1.8.0