From a5e6ddc46a0306f630ac53a8e0e3843bf8c17a05 Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期三, 07 四月 2021 16:43:09 +0800
Subject: [PATCH] 修复日志路径问题

---
 extend/config/config.go |   69 +++++++++++++++++-----------------
 1 files changed, 35 insertions(+), 34 deletions(-)

diff --git a/extend/config/config.go b/extend/config/config.go
index c1a3ff4..bd52bb4 100644
--- a/extend/config/config.go
+++ b/extend/config/config.go
@@ -1,36 +1,37 @@
 package config
 
-import (
-	"github.com/spf13/viper"
-	"log"
-)
-
-type server []ServerInfo
-
-type ServerInfo struct {
-	ServerId string `mapstructure: "serverId"`
-	ServerIp string `mapstructure: "serverIp"`
-	VideoPort string   `mapstructure: "videoPort"`
-	NginxIp string  `mapstructure: "ngxIp"`
-	NginxPort string   `mapstructure: "ngxPort"`
-}
-
-var serverList = &server{}
-
-var ServerMap = make(map[string]string,0)
-var NgxMap = make(map[string]string,0)
-func Init(env string) {
-	var err error
-	viper.SetConfigType("yaml")
-	viper.SetConfigName(env)
-	viper.AddConfigPath("./config/")
-	err = viper.ReadInConfig()
-	if err != nil {
-		log.Fatal("error on parsing configuration file")
-	}
-	viper.UnmarshalKey("server", serverList)
-	for _,s :=range *serverList {
-		ServerMap[s.ServerId] = "http://"+s.ServerIp+":"+s.VideoPort+"/getRecordVideoPath"
-		NgxMap[s.ServerId] = "http://"+s.NginxIp+":"+s.NginxPort+"/videosource"
-	}
-}
\ No newline at end of file
+//import (
+//	"github.com/spf13/viper"
+//	"log"
+//)
+//
+//type server []ServerInfo
+//
+//type ServerInfo struct {
+//	ServerId string `mapstructure: "serverId"`
+//	ServerIp string `mapstructure: "serverIp"`
+//	VideoPort string   `mapstructure: "videoPort"`
+//	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, configPath string) {
+//	var err error
+//	viper.SetConfigType("yaml")
+//	viper.SetConfigName(env)
+//	viper.AddConfigPath(configPath)
+//	err = viper.ReadInConfig()
+//	if err != nil {
+//		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.NgxIp+":"+si.NgxPort+"/videosource"
+//	}
+//}
\ No newline at end of file

--
Gitblit v1.8.0