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:
@@ -692,7 +692,7 @@ func PostMeasureTaskToNF(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
log.Debug("ips:", ips)
|
||||
|
||||
measureTask.NotifyUrl = global.SetNotifyUrl(ips[0], config.GetYamlConfig().Rest[0].Port, fmt.Sprintf(MeasureReportFmt, neType))
|
||||
measureTask.NotifyUrl = global.SetNotifyUrl(ips[0], 33030, fmt.Sprintf(MeasureReportFmt, neType))
|
||||
log.Debug("Measure Task to NF:", measureTask)
|
||||
|
||||
if len(task.NeIds) == 0 {
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
cfg "be.ems/src/framework/config"
|
||||
"be.ems/src/framework/constants"
|
||||
"be.ems/src/framework/database/db"
|
||||
"be.ems/src/framework/utils/parse"
|
||||
)
|
||||
|
||||
type CpuUsage struct {
|
||||
@@ -914,7 +915,15 @@ func GetEMSState(ip string) *SysState {
|
||||
if expiryDateStr == "" {
|
||||
expiryDateStr = "-"
|
||||
}
|
||||
|
||||
var port uint16 = 33030
|
||||
httpArr := cfg.Get("server")
|
||||
if httpArr != nil {
|
||||
arr := httpArr.([]any)
|
||||
if len(arr) > 1 {
|
||||
rest := arr[0].(map[string]any)
|
||||
port = uint16(parse.Number(rest["port"]))
|
||||
}
|
||||
}
|
||||
hostName, _ := os.Hostname()
|
||||
dbInfo := getDbInfo()
|
||||
emsState := &SysState{
|
||||
@@ -922,7 +931,7 @@ func GetEMSState(ip string) *SysState {
|
||||
OsInfo: getUnameStr(),
|
||||
DbInfo: dbInfo,
|
||||
IpAddr: ipAddrs,
|
||||
Port: config.GetYamlConfig().Rest[0].Port,
|
||||
Port: port,
|
||||
Version: global.Version,
|
||||
Capability: CapabilityInt,
|
||||
SerialNum: snStr,
|
||||
|
||||
Reference in New Issue
Block a user