mirror of
https://github.com/nodemailer/wildduck.git
synced 2024-11-10 17:47:07 +08:00
22 lines
679 B
JavaScript
22 lines
679 B
JavaScript
'use strict';
|
|
|
|
const log = require('npmlog');
|
|
const config = require('wild-config');
|
|
|
|
let run = async (task, data, options) => {
|
|
const { acquireCert, certHandler } = options;
|
|
|
|
let certData;
|
|
while ((certData = await certHandler.getNextRenewal())) {
|
|
let cert = await acquireCert(certData.servername, config.acme, certData, certHandler);
|
|
log.verbose('Tasks', 'task=acme-update id=%s servername=%s status=%s', task._id, certData.servername, cert && cert.status);
|
|
}
|
|
|
|
return true;
|
|
};
|
|
|
|
module.exports = (task, data, options, callback) => {
|
|
run(task, data, options)
|
|
.then(response => callback(null, response))
|
|
.catch(callback);
|
|
};
|