feat(notifications): add custom notification support for Dokploy server restart

This commit is contained in:
ChristoferMendes
2025-09-26 17:06:27 -03:00
parent 95714c1749
commit 8a8ed58fef
@@ -5,6 +5,7 @@ import { renderAsync } from "@react-email/components";
import { format } from "date-fns"; import { format } from "date-fns";
import { eq } from "drizzle-orm"; import { eq } from "drizzle-orm";
import { import {
sendCustomNotification,
sendDiscordNotification, sendDiscordNotification,
sendEmailNotification, sendEmailNotification,
sendGotifyNotification, sendGotifyNotification,
@@ -25,11 +26,12 @@ export const sendDokployRestartNotifications = async () => {
slack: true, slack: true,
gotify: true, gotify: true,
ntfy: true, ntfy: true,
custom: true,
}, },
}); });
for (const notification of notificationList) { for (const notification of notificationList) {
const { email, discord, telegram, slack, gotify, ntfy } = notification; const { email, discord, telegram, slack, gotify, ntfy, custom } = notification;
if (email) { if (email) {
const template = await renderAsync( const template = await renderAsync(
@@ -135,5 +137,20 @@ export const sendDokployRestartNotifications = async () => {
console.log(error); console.log(error);
} }
} }
if (custom) {
try {
await sendCustomNotification(custom, {
title: "Dokploy Server Restarted",
message: "Dokploy server has been restarted successfully",
timestamp: date.toISOString(),
date: date.toLocaleString(),
status: "success",
type: "dokploy-restart",
});
} catch (error) {
console.log(error);
}
}
} }
}; };