From 534dc72c2248a545b1b41d11f144448b0fddb6a7 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期三, 11 十二月 2019 11:42:41 +0800
Subject: [PATCH] add log
---
extend/config/config.go | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/extend/config/config.go b/extend/config/config.go
index 2081b5b..3912a95 100644
--- a/extend/config/config.go
+++ b/extend/config/config.go
@@ -1,10 +1,8 @@
package config
import (
- "log"
- "strconv"
-
"github.com/spf13/viper"
+ "log"
)
type server []ServerInfo
@@ -12,9 +10,9 @@
type ServerInfo struct {
ServerId string `mapstructure: "serverId"`
ServerIp string `mapstructure: "serverIp"`
- VideoPort int `mapstructure: "videoPort"`
- NginxIp string `mapstructure: "ngxIp"`
- NginxPort int `mapstructure: "ngxPort"`
+ VideoPort string `mapstructure: "videoPort"`
+ NgxIp string `mapstructure: "ngxIp"`
+ NgxPort string `mapstructure: "ngxPort"`
}
var serverList = &server{}
@@ -28,11 +26,12 @@
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("server", serverList)
for _,s :=range *serverList {
- ServerMap[s.ServerId] = "http://"+s.ServerIp+":"+strconv.Itoa(s.VideoPort)+"/getRecordVideoPath"
- NgxMap[s.ServerId] = "http://"+s.NginxIp+":"+strconv.Itoa(s.NginxPort)+"/videosource"
+ 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