Make certificate renewal a task

This commit is contained in:
Girish Ramakrishnan
2018-12-10 20:20:53 -08:00
parent a76731a991
commit d2f4b68c9f
9 changed files with 35 additions and 33 deletions

View File

@@ -12,7 +12,8 @@ exports = module.exports = {
getLogs: getLogs,
getLogStream: getLogStream,
getStatus: getStatus,
setDashboardDomain: setDashboardDomain
setDashboardDomain: setDashboardDomain,
renewCerts: renewCerts
};
var appstore = require('../appstore.js'),
@@ -192,3 +193,12 @@ function getStatus(req, res, next) {
next(new HttpSuccess(200, status));
});
}
function renewCerts(req, res, next) {
cloudron.renewCerts({ domain: req.query.domain || null }, auditSource(req), function (error) {
if (error && error.reason === CloudronError.NOT_FOUND) return next(new HttpError(404, error.message));
if (error) return next(new HttpError(500, error));
next(new HttpSuccess(202, {}));
});
}