From d72c51144921031d2e32d02f8b9a2d6dce6fd718 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 12 Aug 2016 03:48:21 -0400 Subject: [PATCH] clarify / normalize some options --- README.md | 20 +++++++++++++++----- worker.js | 4 ++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 49e2471..859f0ff 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ var cluster = require('cluster'); module.exports.init = function (sharedOpts) { var cores = require('os').cpus(); - var master = require('letsencrypt-cluster/master').create({ + var leMaster = require('letsencrypt-cluster/master').create({ debug: sharedOpts.debug , server: 'staging' // CHANGE TO PRODUCTION @@ -96,11 +96,21 @@ module.exports.init = function (sharedOpts) { cores.forEach(function () { var worker = cluster.fork(); - master.addWorker(worker); + leMaster.addWorker(worker); }); }; ``` +### API + +All options are passed directly to `node-letsencrypt` +(in other works, `leMaster` is a `letsencrypt` instance), +but a few are only actually used by `letsencrypt-cluster`. + +* `leMaster.approveDomains(options, certs, cb)` is special for `letsencrypt-cluster`, but will probably be included in `node-letsencrypt` in the future (no API change). + +* `leMaster.addWorker(worker)` is added by `letsencrypt-cluster` and **must be called** for each new worker. + Worker ------ @@ -115,7 +125,7 @@ If you want to a non-default `le.challenge` 'use strict'; module.exports.init = function (sharedOpts) { - var worker = require('../worker').create({ + var leWorker = require('letsencrypt-cluster/worker').create({ debug: sharedOpts.debug , renewWithin: sharedOpts.renewWithin @@ -161,10 +171,10 @@ module.exports.init = function (sharedOpts) { } var redirectHttps = require('redirect-https')(); - var plainServer = require('http').createServer(worker.middleware(redirectHttps)); + var plainServer = require('http').createServer(leWorker.middleware(redirectHttps)); plainServer.listen(80); - var server = require('https').createServer(worker.httpsOptions, worker.middleware(app)); + var server = require('https').createServer(leWorker.httpsOptions, leWorker.middleware(app)); server.listen(443); }; ``` diff --git a/worker.js b/worker.js index e24ee6e..73b9732 100644 --- a/worker.js +++ b/worker.js @@ -25,8 +25,8 @@ module.exports.create = function (opts) { }); opts.sni = require('le-sni-auto').create({ - notBefore: opts.notBefore || (10 * 24 * 60 * 60 * 1000) - , notAfter: opts.notAfter || (5 * 24 * 60 * 60 * 1000) + renewWithin: opts.renewWithin || (10 * 24 * 60 * 60 * 1000) + , renewBy: opts.renewBy || (5 * 24 * 60 * 60 * 1000) , getCertificates: function (domain, certs, cb) { var workerOptions = { domains: [ domain ] }; opts.approveDomains(workerOptions, certs, function (_err, results) {