update community member option

This commit is contained in:
AJ ONeal 2018-05-10 02:31:24 -06:00
parent 5171a7d1e0
commit 8fb396cfe9
2 changed files with 13 additions and 10 deletions

View File

@ -103,7 +103,7 @@ LE.create = function (le) {
le.rsaKeySize = le.rsaKeySize || LE.rsaKeySize; le.rsaKeySize = le.rsaKeySize || LE.rsaKeySize;
le.challengeType = le.challengeType || LE.challengeType; le.challengeType = le.challengeType || LE.challengeType;
le._ipc = ipc; le._ipc = ipc;
le._communityPackage = le._communityPackage || 'greenlock'; le._communityPackage = le._communityPackage || 'greenlock.js';
le.agreeToTerms = le.agreeToTerms || function (args, agreeCb) { le.agreeToTerms = le.agreeToTerms || function (args, agreeCb) {
agreeCb(new Error("'agreeToTerms' was not supplied to LE and 'agreeTos' was not supplied to LE.register")); agreeCb(new Error("'agreeToTerms' was not supplied to LE and 'agreeTos' was not supplied to LE.register"));
}; };

View File

@ -384,23 +384,26 @@ module.exports.create = function (le) {
var copy = utils.merge(args, le); var copy = utils.merge(args, le);
args = utils.tplCopy(copy); 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) { return core.certificates.checkAsync(args).then(function (certs) {
if (!certs) { if (!certs) {
// There is no cert available // 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); return core.certificates.registerAsync(args);
} }
if (core.certificates._isRenewable(args, certs)) { if (core.certificates._isRenewable(args, certs)) {
// it's time to renew the available cert // 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); certs.renewing = core.certificates.renewAsync(args, certs);
if (args.waitForRenewal) { if (args.waitForRenewal) {
return certs.renewing; return certs.renewing;