From 51739625176ff24fd09afc49e94eb4edb1327490 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 5 May 2017 17:17:28 -0600 Subject: [PATCH] address #86 should be possible to wait for cert renewal to complete --- lib/core.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/core.js b/lib/core.js index 1e0a448..b3bf834 100644 --- a/lib/core.js +++ b/lib/core.js @@ -382,6 +382,7 @@ module.exports.create = function (le) { // Certificates , getAsync: function (args) { var copy = utils.merge(args, le); + var renewing; args = utils.tplCopy(copy); return core.certificates.checkAsync(args).then(function (certs) { @@ -391,9 +392,14 @@ module.exports.create = function (le) { } 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; }).then(function (results) { // returns pems