From 8fb396cfe9ee694bfa2711d361d1383b871d67fa Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 10 May 2018 02:31:24 -0600 Subject: [PATCH] update community member option --- index.js | 2 +- lib/core.js | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 15148e4..c99a8ed 100644 --- a/index.js +++ b/index.js @@ -103,7 +103,7 @@ LE.create = function (le) { le.rsaKeySize = le.rsaKeySize || LE.rsaKeySize; le.challengeType = le.challengeType || LE.challengeType; le._ipc = ipc; - le._communityPackage = le._communityPackage || 'greenlock'; + le._communityPackage = le._communityPackage || 'greenlock.js'; le.agreeToTerms = le.agreeToTerms || function (args, agreeCb) { agreeCb(new Error("'agreeToTerms' was not supplied to LE and 'agreeTos' was not supplied to LE.register")); }; diff --git a/lib/core.js b/lib/core.js index 83b62a2..e5d41f1 100644 --- a/lib/core.js +++ b/lib/core.js @@ -384,23 +384,26 @@ module.exports.create = function (le) { var copy = utils.merge(args, le); args = utils.tplCopy(copy); - if (args.communityMember && !args._communityMemberAdded) { - try { - require('./community').add(args._communityPackage, args.email, args.domains); - } catch(e) { - // ignore - } - args._communityMemberAdded = true; - } - return core.certificates.checkAsync(args).then(function (certs) { if (!certs) { // There is no cert available + if (args.communityMember && !args._communityMemberAdded) { + try { + require('./community').add(args._communityPackage + ' reg', args.email, args.domains); + } catch(e) { /* ignore */ } + args._communityMemberAdded = true; + } return core.certificates.registerAsync(args); } if (core.certificates._isRenewable(args, certs)) { // it's time to renew the available cert + if (args.communityMember && !args._communityMemberAdded) { + try { + require('./community').add(args._communityPackage + ' renew', args.email, args.domains); + } catch(e) { /* ignore */ } + args._communityMemberAdded = true; + } certs.renewing = core.certificates.renewAsync(args, certs); if (args.waitForRenewal) { return certs.renewing;