Files
AetherForge/server/internal/alerts/settings.go
AetherForge 5fc601b564 feat: fleet ops, KEV scan, tunnels, beacon fallback, persistence
Extend owned-fleet control with scheduled tasks, audit log, file browser,
HTTPS beacon when WS drops, protocol tunnels, registry/autostart forge
options, KEV exposure in full sys check with Telegram alerts, and UI/tests.
2026-06-04 09:34:33 -07:00

43 lines
965 B
Go

package alerts
// Event toggles — all default true in server DefaultConfig.
type EventToggles struct {
AgentConnect bool
AgentReconnect bool
AgentOffline bool
HashrateDrop bool
RejectionRate bool
BuildComplete bool
KEVExposure bool
}
// Settings combines delivery credentials with per-event toggles.
type Settings struct {
NotifyConfig
Events EventToggles
}
func NewSettings(nc NotifyConfig, ev EventToggles) Settings {
return Settings{NotifyConfig: nc, Events: ev}
}
// EnabledForAlertType maps evaluator alert types to toggles.
func (s Settings) EnabledForAlertType(alertType string) bool {
switch alertType {
case "offline":
return s.Events.AgentOffline
case "hashrate_drop":
return s.Events.HashrateDrop
case "rejection_rate":
return s.Events.RejectionRate
default:
return true
}
}
const (
EventAgentConnect = "agent_connect"
EventAgentReconnect = "agent_reconnect"
EventBuildComplete = "build_complete"
)