Generate detailed mail configuration error notification

This commit is contained in:
Girish Ramakrishnan
2019-02-28 16:46:30 -08:00
parent 76255c0dd4
commit a8735a6465
3 changed files with 74 additions and 32 deletions
+19
View File
@@ -29,6 +29,8 @@ exports = module.exports = {
injectPrivateFields: injectPrivateFields,
removePrivateFields: removePrivateFields,
checkConfiguration: checkConfiguration,
SECRET_PLACEHOLDER: String.fromCharCode(0x25CF).repeat(8),
// for testing
@@ -1256,3 +1258,20 @@ function startCleanupTask(auditSource, callback) {
});
});
}
function checkConfiguration(callback) {
assert.strictEqual(typeof callback, 'function');
settings.getBackupConfig(function (error, backupConfig) {
if (error) return callback(error);
let message = '';
if (backupConfig.provider === 'noop') {
message = 'Cloudron backups are disabled. Please ensure this server is backed up using alternate means. See https://cloudron.io/documentation/backups/#storage-providers for more information.';
} else if (backupConfig.provider === 'filesystem' && !backupConfig.externalDisk) {
message = 'Cloudron backups are currently on the same disk as the Cloudron server instance. This is dangerous and can lead to complete data loss if the disk fails. See https://cloudron.io/documentation/backups/#storage-providers for storing backups in an external location.';
}
callback(null, message);
});
}