Compare commits
2 Commits
665e66263a
...
7cebf47125
Author | SHA1 | Date |
---|---|---|
AJ ONeal | 7cebf47125 | |
AJ ONeal | ff39ea58c7 |
9
index.js
9
index.js
|
@ -1,13 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
var DAY = 24 * 60 * 60 * 1000;
|
||||
var HOUR = 60 * 60 * 1000;
|
||||
var MIN = 60 * 1000;
|
||||
var defaults = {
|
||||
// don't renew before the renewWithin period
|
||||
renewWithin: 14 * DAY
|
||||
, _renewWithinMin: 10 * DAY
|
||||
, _renewWithinMin: 3 * DAY
|
||||
// renew before the renewBy period
|
||||
, renewBy: 2 * DAY
|
||||
, renewBy: 10 * DAY
|
||||
, _renewByMin: Math.floor(DAY / 2)
|
||||
// just to account for clock skew really
|
||||
, _dropDead: 5 * MIN
|
||||
|
@ -19,11 +20,11 @@ module.exports.create = function (autoSni) {
|
|||
if (!autoSni.getCertificatesAsync) { autoSni.getCertificatesAsync = require('bluebird').promisify(autoSni.getCertificates); }
|
||||
if (!autoSni.renewWithin) { autoSni.renewWithin = autoSni.notBefore || defaults.renewWithin; }
|
||||
if (autoSni.renewWithin < defaults._renewWithinMin) {
|
||||
throw new Error("options.renewWithin should be at least 3 days");
|
||||
throw new Error("options.renewWithin should be at least " + (defaults._renewWithinMin / DAY) + " days");
|
||||
}
|
||||
if (!autoSni.renewBy) { autoSni.renewBy = autoSni.notAfter || defaults.renewBy; }
|
||||
if (autoSni.renewBy < defaults._renewByMin) {
|
||||
throw new Error("options.renewBy should be at least 12 hours");
|
||||
throw new Error("options.renewBy should be at least " + (defaults._renewBy / HOUR) + " hours");
|
||||
}
|
||||
if (!autoSni.tlsOptions) { autoSni.tlsOptions = autoSni.httpsOptions || {}; }
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "le-sni-auto",
|
||||
"version": "2.1.2",
|
||||
"version": "2.1.3",
|
||||
"description": "An auto-sni strategy for registering and renewing letsencrypt certificates using SNICallback",
|
||||
"homepage": "https://git.coolaj86.com/coolaj86/le-sni-auto.js",
|
||||
"main": "index.js",
|
||||
|
|
Loading…
Reference in New Issue