[优化] 移除不必要的支持文件过滤函数,更新相关测试以验证 WAF 配置包含

This commit is contained in:
ryan
2026-05-30 15:39:18 +08:00
parent 1bff2dadd4
commit e094f4a3b7
5 changed files with 46 additions and 21 deletions
-18
View File
@@ -230,7 +230,6 @@ func GetActiveConfigForAgent() (*AgentConfigResponse, error) {
return nil, err
}
}
supportFiles = filterAgentSupportFiles(supportFiles)
slog.Debug("agent fetched active config", "version", version.Version, "checksum", version.Checksum)
return &AgentConfigResponse{
Version: version.Version,
@@ -243,23 +242,6 @@ func GetActiveConfigForAgent() (*AgentConfigResponse, error) {
}, nil
}
func filterAgentSupportFiles(files []SupportFile) []SupportFile {
if len(files) == 0 {
return nil
}
filtered := make([]SupportFile, 0, len(files))
for _, file := range files {
path := strings.ToLower(strings.TrimSpace(file.Path))
switch {
case strings.HasSuffix(path, ".crt"), strings.HasSuffix(path, ".key"), strings.HasSuffix(path, ".pem"):
filtered = append(filtered, file)
case path == "pow_config.json":
filtered = append(filtered, file)
}
}
return filtered
}
func ReportApplyLog(payload ApplyLogPayload) (*model.ApplyLog, error) {
now := time.Now()
payload.NodeID = strings.TrimSpace(payload.NodeID)