send a message for cert renewal status

This commit is contained in:
Girish Ramakrishnan
2016-03-19 20:40:03 -07:00
parent 5042741435
commit 11513f9428
3 changed files with 41 additions and 0 deletions

View File

@@ -20,6 +20,8 @@ exports = module.exports = {
outOfDiskSpace: outOfDiskSpace,
certificateRenewed: certificateRenewed,
FEEDBACK_TYPE_FEEDBACK: 'feedback',
FEEDBACK_TYPE_TICKET: 'ticket',
FEEDBACK_TYPE_APP_MISSING: 'app_missing',
@@ -375,6 +377,20 @@ function outOfDiskSpace(message) {
sendMails([ mailOptions ]);
}
function certificateRenewed(domain, message) {
assert.strictEqual(typeof domain, 'string');
assert.strictEqual(typeof message, 'string');
var mailOptions = {
from: config.adminEmail(),
to: 'admin@cloudron.io',
subject: util.format('[%s] Certificate was %s renewed', domain, message ? 'not' : ''),
text: render('certificate_renewed.ejs', { domain: domain, message: message, format: 'text' })
};
sendMails([ mailOptions ]);
}
// this function bypasses the queue intentionally. it is also expected to work without the mailer module initialized
// crashnotifier should be able to send mail when there is no db
function sendCrashNotification(program, context) {