| | |
| | | package config |
| | | |
| | | import ( |
| | | "log" |
| | | "strconv" |
| | | |
| | | "github.com/spf13/viper" |
| | | "log" |
| | | ) |
| | | |
| | | 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"` |
| | | VideoPort string `mapstructure: "videoPort"` |
| | | NgxIp string `mapstructure: "ngxIp"` |
| | | NgxPort string `mapstructure: "ngxPort"` |
| | | } |
| | | |
| | | var serverList = &server{} |
| | |
| | | } |
| | | 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" |
| | | } |
| | | } |