needRegistration callback

This commit is contained in:
AJ ONeal 2015-12-12 15:50:00 +00:00
parent 9f3e122156
commit be254c087f
1 changed files with 23 additions and 8 deletions

View File

@ -50,6 +50,10 @@ module.exports.create = function (letsencrypt, defaults, options) {
return copy; return copy;
} }
function isCurrent(cache) {
return cache;
}
function sniCallback(hostname, cb) { function sniCallback(hostname, cb) {
var args = merge({}); var args = merge({});
args.domains = [hostname]; args.domains = [hostname];
@ -59,15 +63,26 @@ module.exports.create = function (letsencrypt, defaults, options) {
return; return;
} }
if (!cache.context) { function respond(c2) {
cache.context = tls.createSecureContext({ cache = c2 || cache;
key: cache.key // privkey.pem
, cert: cache.cert // fullchain.pem if (!cache.context) {
//, ciphers // node's defaults are great cache.context = tls.createSecureContext({
}); key: cache.key // privkey.pem
, cert: cache.cert // fullchain.pem
//, ciphers // node's defaults are great
});
}
cb(null, cache.context);
} }
cb(null, cache.context); if (isCurrent(cache)) {
respond();
return;
}
defaults.needsRegistration(hostname, respond);
}); });
} }