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

View File

@@ -5,6 +5,7 @@ import { renderAsync } from "@react-email/components";
import { format } from "date-fns";
import { eq } from "drizzle-orm";
import {
sendCustomNotification,
sendDiscordNotification,
sendEmailNotification,
sendGotifyNotification,
@@ -25,11 +26,12 @@ export const sendDokployRestartNotifications = async () => {
slack: true,
gotify: true,
ntfy: true,
custom: true,
},
});
for (const notification of notificationList) {
const { email, discord, telegram, slack, gotify, ntfy } = notification;
const { email, discord, telegram, slack, gotify, ntfy, custom } = notification;
if (email) {
const template = await renderAsync(
@@ -135,5 +137,20 @@ export const sendDokployRestartNotifications = async () => {
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);
}
}
}
};