mirror of
https://github.com/fosrl/pangolin.git
synced 2026-04-29 01:08:13 +00:00
Update websocket to be consistant with streaming
This commit is contained in:
@@ -29,6 +29,8 @@ import logger from "@server/logger";
|
||||
import { fromError } from "zod-validation-error";
|
||||
import { OpenAPITags, registry } from "@server/openApi";
|
||||
import { and, eq } from "drizzle-orm";
|
||||
import { encrypt } from "@server/lib/crypto";
|
||||
import config from "@server/lib/config";
|
||||
|
||||
const SITE_EVENT_TYPES = ["site_online", "site_offline"] as const;
|
||||
const HC_EVENT_TYPES = [
|
||||
@@ -302,11 +304,12 @@ export async function updateAlertRule(
|
||||
.where(eq(alertWebhookActions.alertRuleId, alertRuleId));
|
||||
|
||||
if (webhookActions.length > 0) {
|
||||
const serverSecret = config.getRawConfig().server.secret!;
|
||||
await db.insert(alertWebhookActions).values(
|
||||
webhookActions.map((wa) => ({
|
||||
alertRuleId,
|
||||
webhookUrl: wa.webhookUrl,
|
||||
config: wa.config ?? null,
|
||||
config: wa.config != null ? encrypt(wa.config, serverSecret) : null,
|
||||
enabled: wa.enabled
|
||||
}))
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user