fix(watchdog): fix watchdog unable to send webhook and simplify the parsing of json config
- Change webhook config headers and body from map to string format - Move command parsing logic to separate function in command.go - Add debug logging for webhook operations - Improve exception handling with proper JSON parsing - Simplify config loading logic with default values
This commit is contained in:
+2
-11
@@ -5,8 +5,6 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
"super-frpc/postLog"
|
||||
"super-frpc/utils"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
@@ -117,15 +115,8 @@ func recvMsg() {
|
||||
}
|
||||
// Here add logic to handle the message
|
||||
if !isResponseMessage(line) {
|
||||
postLog.Debug(fmt.Sprintf("[Watchdog] TCP Socket received message: %s", line))
|
||||
cmdType := utils.GetCmdType(line)
|
||||
if cmdType == "Exception" {
|
||||
exceptionType := utils.GetCmdParams(line, "exceptionType")
|
||||
serviceName := utils.GetCmdParams(line, "serviceName")
|
||||
errorMsg := utils.GetCmdParams(line, "errorMsg")
|
||||
postLog.Error(fmt.Sprintf("[Watchdog] Exception[%s]: %s, %s", serviceName, exceptionType, errorMsg))
|
||||
exceptionHandle(exceptionType, serviceName, errorMsg)
|
||||
}
|
||||
// postLog.Debug(fmt.Sprintf("[Watchdog] TCP Socket received message: %s", line))
|
||||
parseCommand(line)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user