From b46659034d1007b5547b4bfa516d110d8e5f1a9a Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期五, 01 十一月 2019 15:57:40 +0800 Subject: [PATCH] mv config --- /dev/null | 38 -------------------------------------- extend/config/config.go | 1 + 2 files changed, 1 insertions(+), 38 deletions(-) diff --git a/config/config.go b/config/config.go deleted file mode 100644 index 2081b5b..0000000 --- a/config/config.go +++ /dev/null @@ -1,38 +0,0 @@ -package config - -import ( - "log" - "strconv" - - "github.com/spf13/viper" -) - -type server []ServerInfo - -type ServerInfo struct { - ServerId string `mapstructure: "serverId"` - ServerIp string `mapstructure: "serverIp"` - VideoPort int `mapstructure: "videoPort"` - NginxIp string `mapstructure: "ngxIp"` - NginxPort int `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+":"+strconv.Itoa(s.VideoPort)+"/getRecordVideoPath" - NgxMap[s.ServerId] = "http://"+s.NginxIp+":"+strconv.Itoa(s.NginxPort)+"/videosource" - } -} \ No newline at end of file diff --git a/extend/config/config.go b/extend/config/config.go new file mode 100644 index 0000000..d912156 --- /dev/null +++ b/extend/config/config.go @@ -0,0 +1 @@ +package config -- Gitblit v1.8.0