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:
@@ -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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user