Zod validated config for security and ease of getting started

This commit is contained in:
Kalle
2026-06-15 14:12:15 +03:00
parent 215243e071
commit 75179e5077
46 changed files with 386 additions and 275 deletions

View File

@@ -1,29 +0,0 @@
import { logger } from "~/utils/logger";
const DISCORD_ADMIN_WEBHOOK_URL = process.env.DISCORD_ADMIN_WEBHOOK_URL;
if (!DISCORD_ADMIN_WEBHOOK_URL) {
logger.info(
"DISCORD_ADMIN_WEBHOOK_URL not set, admin notifications disabled",
);
}
export async function send(message: string): Promise<void> {
if (!DISCORD_ADMIN_WEBHOOK_URL) {
return;
}
try {
const response = await fetch(DISCORD_ADMIN_WEBHOOK_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ content: message }),
});
if (!response.ok) {
logger.error(`Failed to send admin notification: ${response.status}`);
}
} catch (error) {
logger.error("Failed to send admin notification", error);
}
}