diff --git a/src/custom.js b/src/custom.js index 5babaf0ac..a6746cc47 100644 --- a/src/custom.js +++ b/src/custom.js @@ -12,10 +12,6 @@ exports = module.exports = { }; const DEFAULT_SPEC = { - alerts: { - email: '', - notifyCloudronAdmins: true - }, footer: { body: '© 2020 [Cloudron](https://cloudron.io) [Forum ](https://forum.cloudron.io)' } diff --git a/src/notifications.js b/src/notifications.js index 5d768e0ea..b143ee641 100644 --- a/src/notifications.js +++ b/src/notifications.js @@ -25,7 +25,6 @@ let assert = require('assert'), auditSource = require('./auditsource.js'), BoxError = require('./boxerror.js'), changelog = require('./changelog.js'), - custom = require('./custom.js'), debug = require('debug')('box:notifications'), eventlog = require('./eventlog.js'), mailer = require('./mailer.js'), @@ -167,9 +166,6 @@ function oomEvent(eventId, app, addon, containerId, event, callback) { message = 'The container has been restarted automatically. Consider increasing the [memory limit](https://docs.docker.com/v17.09/edge/engine/reference/commandline/update/#update-a-containers-kernel-memory-constraints)'; } - if (custom.spec().alerts.email) mailer.oomEvent(custom.spec().alerts.email, program, event); - if (!custom.spec().alerts.notifyCloudronAdmins) return callback(); - actionForAllAdmins([], function (admin, done) { mailer.oomEvent(admin.email, program, event); @@ -182,9 +178,6 @@ function appUp(eventId, app, callback) { assert.strictEqual(typeof app, 'object'); assert.strictEqual(typeof callback, 'function'); - if (custom.spec().alerts.email) mailer.appUp(custom.spec().alerts.email, app); - if (!custom.spec().alerts.notifyCloudronAdmins) return callback(); - actionForAllAdmins([], function (admin, done) { mailer.appUp(admin.email, app); add(admin.id, eventId, `App ${app.fqdn} is back online`, `The application ${app.manifest.title} installed at ${app.fqdn} is back online.`, done); @@ -196,9 +189,6 @@ function appDied(eventId, app, callback) { assert.strictEqual(typeof app, 'object'); assert.strictEqual(typeof callback, 'function'); - if (custom.spec().alerts.email) mailer.appDied(custom.spec().alerts.email, app); - if (!custom.spec().alerts.notifyCloudronAdmins) return callback(); - actionForAllAdmins([], function (admin, callback) { mailer.appDied(admin.email, app); add(admin.id, eventId, `App ${app.fqdn} is down`, `The application ${app.manifest.title} installed at ${app.fqdn} is not responding.`, callback); @@ -246,9 +236,6 @@ function boxUpdateError(eventId, errorMessage, callback) { assert.strictEqual(typeof errorMessage, 'string'); assert.strictEqual(typeof callback, 'function'); - if (custom.spec().alerts.email) mailer.boxUpdateError(custom.spec().alerts.email, errorMessage); - if (!custom.spec().alerts.notifyCloudronAdmins) return callback(); - actionForAllAdmins([], function (admin, done) { mailer.boxUpdateError(admin.email, errorMessage); add(admin.id, eventId, 'Cloudron update failed', `Failed to update Cloudron: ${errorMessage}. Update will be retried in 4 hours`, done); @@ -261,9 +248,6 @@ function certificateRenewalError(eventId, vhost, errorMessage, callback) { assert.strictEqual(typeof errorMessage, 'string'); assert.strictEqual(typeof callback, 'function'); - if (custom.spec().alerts.email) mailer.certificateRenewalError(custom.spec().alerts.email, vhost, errorMessage); - if (!custom.spec().alerts.notifyCloudronAdmins) return callback(); - actionForAllAdmins([], function (admin, callback) { mailer.certificateRenewalError(admin.email, vhost, errorMessage); add(admin.id, eventId, `Certificate renewal of ${vhost} failed`, `Failed to new certs of ${vhost}: ${errorMessage}. Renewal will be retried in 12 hours`, callback); @@ -276,9 +260,6 @@ function backupFailed(eventId, taskId, errorMessage, callback) { assert.strictEqual(typeof errorMessage, 'string'); assert.strictEqual(typeof callback, 'function'); - if (custom.spec().alerts.email) mailer.backupFailed(custom.spec().alerts.email, errorMessage, `${settings.adminOrigin()}/logs.html?taskId=${taskId}`); - if (!custom.spec().alerts.notifyCloudronAdmins) return callback(); - actionForAllAdmins([], function (admin, callback) { mailer.backupFailed(admin.email, errorMessage, `${settings.adminOrigin()}/logs.html?taskId=${taskId}`); add(admin.id, eventId, 'Backup failed', `Backup failed: ${errorMessage}. Logs are available [here](/logs.html?taskId=${taskId}). Will be retried in 4 hours`, callback);