From bb211e8f4290bceb5de7614393fc5b38c74d5df5 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 15 Aug 2016 14:36:58 -0600 Subject: [PATCH] add le.httpsOptions with le.sni.sniCallback --- index.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 40ab16d..c8ca05a 100644 --- a/index.js +++ b/index.js @@ -59,7 +59,6 @@ LE.create = function (le) { le.store = le.store || require('le-store-certbot').create({ debug: le.debug }); le.challenge = le.challenge || require('le-challenge-fs').create({ debug: le.debug }); le.core = require('./lib/core'); - le.sni = le.sni || require('le-sni-auto'); le = LE._undefine(le); le.acmeChallengePrefix = LE.acmeChallengePrefix; @@ -118,8 +117,19 @@ LE.create = function (le) { } }); - if (le.sni.create) { - le.sni = le.sni.create(le); + le.sni = le.sni || null; + if (!le.httpsOptions) { + le.httpsOptions = {}; + } + if (!le.httpsOptions.SNICallback) { + le.sni = le.sni || require('le-sni-auto'); + if (le.sni.create) { + le.sni = le.sni.create(le); + } + le.httpsOptions.SNICallback = le.sni.sniCallback; + } + if (!le.httpsOptions.key || !le.httpsOptions.cert) { + le.httpsOptions = require('localhost.daplie.com-certificates').merge(le.httpsOptions); } /* le.sni = PromiseA.promisifyAll(le.sni);