Refactor server configuration and update certificate handling
- Changed the NotifyUrl in PostMeasureTaskToNF to use a hardcoded port (33030). - Updated GetEMSState to retrieve the port from the server configuration instead of the YAML config. - Removed deprecated RestParam struct and related code from YamlConfig. - Deleted old certificate files (omc-server.crt, omc-server.key, omc-web.crt, omc-web.key). - Added new certificate files (www.omc.net.crt, www.omc.net.key) for updated server configuration. - Modified local/omc.yaml to reflect changes in server configuration and certificate paths. - Updated main.go to load server configuration instead of rest configuration, ensuring proper handling of multiple HTTP services.
This commit is contained in:
18
main.go
18
main.go
@@ -219,20 +219,20 @@ func loadGlobalPre(app *gin.Engine) {
|
||||
|
||||
// loadServer 多个HTTP服务启动
|
||||
func loadServer(app *gin.Engine) {
|
||||
httpArr := config.Get("rest")
|
||||
httpArr := config.Get("server")
|
||||
if httpArr == nil {
|
||||
logger.Errorf("rest config not found")
|
||||
logger.Errorf("server config not found")
|
||||
return
|
||||
}
|
||||
for _, v := range httpArr.([]any) {
|
||||
rest := v.(map[string]any)
|
||||
port := parse.Number(rest["port"])
|
||||
ipv4 := fmt.Sprint(rest["ipv4"])
|
||||
ipv6 := fmt.Sprint(rest["ipv6"])
|
||||
schema := fmt.Sprint(rest["schema"])
|
||||
item := v.(map[string]any)
|
||||
port := parse.Number(item["port"])
|
||||
ipv4 := fmt.Sprint(item["ipv4"])
|
||||
ipv6 := fmt.Sprint(item["ipv6"])
|
||||
schema := fmt.Sprint(item["schema"])
|
||||
if schema == "https" && schema != "<nil>" {
|
||||
certFile := fmt.Sprint(rest["certfile"])
|
||||
keyFile := fmt.Sprint(rest["keyfile"])
|
||||
certFile := fmt.Sprint(item["certfile"])
|
||||
keyFile := fmt.Sprint(item["keyfile"])
|
||||
addr := ""
|
||||
if ipv4 != "" && ipv4 != "<nil>" {
|
||||
addr = fmt.Sprintf("%s:%d", ipv4, port)
|
||||
|
||||
Reference in New Issue
Block a user