Split setting of dns records from mail config route

This allows us to enable email server but not setup the dns records
yet. Useful for importing existing mailboxes from another server
without adjusting the DNS.
This commit is contained in:
Girish Ramakrishnan
2018-07-25 10:29:26 -07:00
parent 589602cdb0
commit c063267c72
3 changed files with 29 additions and 1 deletions
+14
View File
@@ -7,6 +7,8 @@ exports = module.exports = {
updateDomain: updateDomain,
removeDomain: removeDomain,
setDnsRecords: setDnsRecords,
getStatus: getStatus,
setMailFromValidation: setMailFromValidation,
@@ -93,6 +95,18 @@ function updateDomain(req, res, next) {
});
}
function setDnsRecords(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
assert.strictEqual(typeof req.params.domain, 'string');
mail.setDnsRecords(req.params.domain, function (error) {
if (error && error.reason === MailError.NOT_FOUND) return next(new HttpError(404, error.message));
if (error) return next(new HttpError(500, error));
next(new HttpSuccess(201));
});
}
function removeDomain(req, res, next) {
assert.strictEqual(typeof req.params.domain, 'string');