address #86 should be possible to wait for cert renewal to complete

This commit is contained in:
AJ ONeal 2017-05-05 17:17:28 -06:00
parent f9a937c5f8
commit 5173962517
1 changed files with 7 additions and 1 deletions

View File

@ -382,6 +382,7 @@ module.exports.create = function (le) {
// Certificates // Certificates
, getAsync: function (args) { , getAsync: function (args) {
var copy = utils.merge(args, le); var copy = utils.merge(args, le);
var renewing;
args = utils.tplCopy(copy); args = utils.tplCopy(copy);
return core.certificates.checkAsync(args).then(function (certs) { return core.certificates.checkAsync(args).then(function (certs) {
@ -391,9 +392,14 @@ module.exports.create = function (le) {
} }
if (core.certificates._isRenewable(args, certs)) { if (core.certificates._isRenewable(args, certs)) {
certs._renewing = core.certificates.renewAsync(args, certs); // it's time to renew the available cert
renewing = core.certificates.renewAsync(args, certs);
if (args.waitForRenewal) {
return renewing;
}
} }
// return existing unexpired (although potentially stale) certificates when available
return certs; return certs;
}).then(function (results) { }).then(function (results) {
// returns pems // returns pems