Compare commits
1 Commits
31c1f87f93
...
fd06582813
Author | SHA1 | Date |
---|---|---|
AJ ONeal | fd06582813 |
12
index.js
12
index.js
|
@ -13,11 +13,19 @@ var defaults = {
|
|||
// just to account for clock skew really
|
||||
, _dropDead: 5 * MIN
|
||||
};
|
||||
var promisify = require('util').promisify;
|
||||
if (!promisify) {
|
||||
try {
|
||||
promisify = require('bluebird').promisify;
|
||||
} catch(e) {
|
||||
console.error("You're running an older version of node that doesn't have 'promisify'. Please run 'npm install bluebird --save'.");
|
||||
}
|
||||
}
|
||||
|
||||
// autoSni = { renewWithin, renewBy, getCertificates, tlsOptions, _dbg_now }
|
||||
module.exports.create = function (autoSni) {
|
||||
|
||||
if (!autoSni.getCertificatesAsync) { autoSni.getCertificatesAsync = require('bluebird').promisify(autoSni.getCertificates); }
|
||||
if (!autoSni.getCertificatesAsync) { autoSni.getCertificatesAsync = 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 " + (defaults._renewWithinMin / DAY) + " days");
|
||||
|
@ -123,7 +131,7 @@ module.exports.create = function (autoSni) {
|
|||
else if (certMeta.then) {
|
||||
//log(autoSni.debug, "PROMISED CERT", domain);
|
||||
// we are already getting a cert
|
||||
promise = certMeta
|
||||
promise = certMeta;
|
||||
}
|
||||
else if (now >= certMeta.expiresNear) {
|
||||
//log(autoSni.debug, "EXPIRED CERT");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "le-sni-auto",
|
||||
"version": "2.1.7",
|
||||
"version": "2.1.8",
|
||||
"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