various notification fixes

This commit is contained in:
Girish Ramakrishnan
2024-12-11 23:32:11 +01:00
parent fbe207dac3
commit be340580d4
10 changed files with 28 additions and 34 deletions

View File

@@ -195,7 +195,7 @@ async function appDown(mailTo, app) {
from: mailConfig.notificationFrom,
to: mailTo,
subject: `[${mailConfig.cloudronName}] App ${app.fqdn} is down`,
text: render('app_down.ejs', { title: app.manifest.title, appFqdn: app.fqdn, notificationsUrl: mailConfig.notificationsUrl })
text: render('app_down-text.ejs', { title: app.manifest.title, appFqdn: app.fqdn, notificationsUrl: mailConfig.notificationsUrl })
};
await sendMail(mailOptions);
@@ -211,17 +211,17 @@ async function appUp(mailTo, app) {
from: mailConfig.notificationFrom,
to: mailTo,
subject: `[${mailConfig.cloudronName}] App ${app.fqdn} is back online`,
text: render('app_up.ejs', { title: app.manifest.title, appFqdn: app.fqdn, notificationsUrl: mailConfig.notificationsUrl })
text: render('app_up-text.ejs', { title: app.manifest.title, appFqdn: app.fqdn, notificationsUrl: mailConfig.notificationsUrl })
};
await sendMail(mailOptions);
}
async function oomEvent(mailTo, app, addon, containerId, event) {
async function oomEvent(mailTo, containerId, app, addon, event) {
assert.strictEqual(typeof mailTo, 'string');
assert.strictEqual(typeof containerId, 'string');
assert.strictEqual(typeof app, 'object');
assert.strictEqual(typeof addon, 'object');
assert.strictEqual(typeof containerId, 'string');
assert.strictEqual(typeof event, 'object');
const mailConfig = await getMailConfig();
@@ -239,7 +239,7 @@ async function oomEvent(mailTo, app, addon, containerId, event) {
from: mailConfig.notificationFrom,
to: mailTo,
subject: `[${mailConfig.cloudronName}] ${app ? app.fqdn : addon.name} was restarted (OOM)`,
text: render('oom_event.ejs', templateData)
text: render('oom_event-text.ejs', templateData)
};
await sendMail(mailOptions);
@@ -256,7 +256,7 @@ async function backupFailed(mailTo, errorMessage, logUrl) {
from: mailConfig.notificationFrom,
to: mailTo,
subject: `[${mailConfig.cloudronName}] Failed to backup`,
text: render('backup_failed.ejs', { cloudronName: mailConfig.cloudronName, message: errorMessage, logUrl, notificationsUrl: mailConfig.notificationsUrl })
text: render('backup_failed-text.ejs', { cloudronName: mailConfig.cloudronName, message: errorMessage, logUrl, notificationsUrl: mailConfig.notificationsUrl })
};
await sendMail(mailOptions);
@@ -273,7 +273,7 @@ async function certificateRenewalError(mailTo, domain, message) {
from: mailConfig.notificationFrom,
to: mailTo,
subject: `[${mailConfig.cloudronName}] Certificate renewal error`,
text: render('certificate_renewal_error.ejs', { domain, message, notificationsUrl: mailConfig.notificationsUrl })
text: render('certificate_renewal_error-text.ejs', { domain, message, notificationsUrl: mailConfig.notificationsUrl })
};
await sendMail(mailOptions);
@@ -290,7 +290,7 @@ async function sendTestMail(domain, email) {
from: `"${mailConfig.cloudronName}" <no-reply@${domain}>`,
to: email,
subject: `[${mailConfig.cloudronName}] Test Email`,
text: render('test.ejs', { cloudronName: mailConfig.cloudronName}),
text: render('test-text.ejs', { cloudronName: mailConfig.cloudronName}),
html: render('test-html.ejs', { cloudronName: mailConfig.cloudronName })
};