Compare commits

..

No commits in common. "7cebf4712512e9eb14f42064215b4c35ea550c6e" and "665e66263a7f590ec6ed66944e3d9682d237f7e0" have entirely different histories.

2 changed files with 5 additions and 6 deletions

View File

@ -1,14 +1,13 @@
'use strict'; 'use strict';
var DAY = 24 * 60 * 60 * 1000; var DAY = 24 * 60 * 60 * 1000;
var HOUR = 60 * 60 * 1000;
var MIN = 60 * 1000; var MIN = 60 * 1000;
var defaults = { var defaults = {
// don't renew before the renewWithin period // don't renew before the renewWithin period
renewWithin: 14 * DAY renewWithin: 14 * DAY
, _renewWithinMin: 3 * DAY , _renewWithinMin: 10 * DAY
// renew before the renewBy period // renew before the renewBy period
, renewBy: 10 * DAY , renewBy: 2 * DAY
, _renewByMin: Math.floor(DAY / 2) , _renewByMin: Math.floor(DAY / 2)
// just to account for clock skew really // just to account for clock skew really
, _dropDead: 5 * MIN , _dropDead: 5 * MIN
@ -20,11 +19,11 @@ module.exports.create = function (autoSni) {
if (!autoSni.getCertificatesAsync) { autoSni.getCertificatesAsync = require('bluebird').promisify(autoSni.getCertificates); } if (!autoSni.getCertificatesAsync) { autoSni.getCertificatesAsync = require('bluebird').promisify(autoSni.getCertificates); }
if (!autoSni.renewWithin) { autoSni.renewWithin = autoSni.notBefore || defaults.renewWithin; } if (!autoSni.renewWithin) { autoSni.renewWithin = autoSni.notBefore || defaults.renewWithin; }
if (autoSni.renewWithin < defaults._renewWithinMin) { if (autoSni.renewWithin < defaults._renewWithinMin) {
throw new Error("options.renewWithin should be at least " + (defaults._renewWithinMin / DAY) + " days"); throw new Error("options.renewWithin should be at least 3 days");
} }
if (!autoSni.renewBy) { autoSni.renewBy = autoSni.notAfter || defaults.renewBy; } if (!autoSni.renewBy) { autoSni.renewBy = autoSni.notAfter || defaults.renewBy; }
if (autoSni.renewBy < defaults._renewByMin) { if (autoSni.renewBy < defaults._renewByMin) {
throw new Error("options.renewBy should be at least " + (defaults._renewBy / HOUR) + " hours"); throw new Error("options.renewBy should be at least 12 hours");
} }
if (!autoSni.tlsOptions) { autoSni.tlsOptions = autoSni.httpsOptions || {}; } if (!autoSni.tlsOptions) { autoSni.tlsOptions = autoSni.httpsOptions || {}; }

View File

@ -1,6 +1,6 @@
{ {
"name": "le-sni-auto", "name": "le-sni-auto",
"version": "2.1.3", "version": "2.1.2",
"description": "An auto-sni strategy for registering and renewing letsencrypt certificates using SNICallback", "description": "An auto-sni strategy for registering and renewing letsencrypt certificates using SNICallback",
"homepage": "https://git.coolaj86.com/coolaj86/le-sni-auto.js", "homepage": "https://git.coolaj86.com/coolaj86/le-sni-auto.js",
"main": "index.js", "main": "index.js",