@root/greenlock
Advanced tools
Comparing version 3.0.3 to 3.0.4
@@ -74,3 +74,3 @@ 'use strict'; | ||
// notify in the background | ||
var renewAt = C._renewableAt(gnlck, mconf, args, newPems); | ||
var renewAt = C._renewWithStagger(gnlck, mconf, args, newPems); | ||
gnlck._notify(evname, { | ||
@@ -81,2 +81,8 @@ renewAt: renewAt, | ||
}); | ||
gnlck._notify('_cert_issue', { | ||
renewAt: renewAt, | ||
subject: args.subject, | ||
altnames: args.altnames, | ||
pems: newPems | ||
}); | ||
}).catch(function(err) { | ||
@@ -170,11 +176,2 @@ if (!err.context) { | ||
.then(function(pems) { | ||
var renewAt = C._renewableAt(gnlck, mconf, args, pems); | ||
gnlck._notify('_cert_issue', { | ||
renewAt: renewAt, | ||
subject: args.subject, | ||
altnames: args.altnames, | ||
pems: pems | ||
}); | ||
if (kresult.exists) { | ||
@@ -275,12 +272,40 @@ return pems; | ||
C._renewableAt = function(gnlck, mconf, args, pems) { | ||
if (args.renewAt) { | ||
return args.renewAt; | ||
C._renewWithStagger = function(gnlck, mconf, args, pems) { | ||
var renewOffset = C._renewOffset(gnlck, mconf, args, pems); | ||
var renewStagger; | ||
try { | ||
renewStagger = U._parseDuration( | ||
args.renewStagger || | ||
mconf.renewStagger || | ||
gnlck._defaults.renewStagger || | ||
0 | ||
); | ||
} catch (e) { | ||
renewStagger = U._parseDuration(gnlck._defaults.renewStagger); | ||
} | ||
var renewOffset = | ||
// TODO check this beforehand | ||
if (!args.force && renewStagger / renewOffset >= 0.5) { | ||
renewStagger = renewOffset * 0.1; | ||
} | ||
if (renewOffset > 0) { | ||
// stagger forward, away from issued at | ||
return Math.round( | ||
pems.issuedAt + renewOffset + Math.random() * renewStagger | ||
); | ||
} | ||
// stagger backward, toward issued at | ||
return Math.round( | ||
pems.expiresAt + renewOffset - Math.random() * renewStagger | ||
); | ||
}; | ||
C._renewOffset = function(gnlck, mconf, args, pems) { | ||
var renewOffset = U._parseDuration( | ||
args.renewOffset || | ||
mconf.renewOffset || | ||
gnlck._defaults.renewOffset || | ||
0; | ||
mconf.renewOffset || | ||
gnlck._defaults.renewOffset || | ||
0 | ||
); | ||
var week = 1000 * 60 * 60 * 24 * 6; | ||
@@ -292,3 +317,11 @@ if (!args.force && Math.abs(renewOffset) < week) { | ||
} | ||
return renewOffset; | ||
}; | ||
C._renewableAt = function(gnlck, mconf, args, pems) { | ||
if (args.renewAt) { | ||
return args.renewAt; | ||
} | ||
var renewOffset = C._renewOffset(gnlck, mconf, args, pems); | ||
if (renewOffset > 0) { | ||
@@ -295,0 +328,0 @@ return pems.issuedAt + renewOffset; |
{ | ||
"name": "@root/greenlock", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"description": "The easiest Let's Encrypt client for Node.js and Browsers", | ||
@@ -5,0 +5,0 @@ "homepage": "https://rootprojects.org/greenlock/", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83275
2277