From 8a689f7b8d4163f020e5711a8993de5fb8a8b5cb Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 16 Aug 2016 13:05:41 -0400 Subject: [PATCH] v2.0.0 --- README.md | 4 ++-- examples/force-renew.js | 22 ++++++++++++++++++++++ examples/simple.js | 20 ++++++++++++++++++++ lex.js | 4 +++- package.json | 2 +- 5 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 examples/force-renew.js create mode 100644 examples/simple.js diff --git a/README.md b/README.md index 6a1486f..26db174 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ npm install --save letsencrypt-express@2.x QuickStart ========== -Here's a completely working (but terribly oversimplified) example that will get you started: +Here's a completely working example that will get you started: `app.js`: ```javascript @@ -129,7 +129,7 @@ var lex = require('letsencrypt-express').create({ opts.agreeTos = true; } - cb(null, opts); + cb(null, { options: opts, certs: certs }); } }); diff --git a/examples/force-renew.js b/examples/force-renew.js new file mode 100644 index 0000000..b2599d2 --- /dev/null +++ b/examples/force-renew.js @@ -0,0 +1,22 @@ +'use strict'; + +//require('letsencrypt-express') +require('../').create({ + + server: 'staging' + +, email: 'aj@daplie.com' + +, agreeTos: true + +, approvedDomains: [ 'pokemap.hellabit.com', 'www.pokemap.hellabit.com' ] + +, app: require('express')().use('/', function (req, res) { + res.end('Hello, World!'); + }) + +, renewWithin: (91 * 24 * 60 * 60 * 1000) +, renewBy: (90 * 24 * 60 * 60 * 1000) + +, debug: true +}).listen(80, 443); diff --git a/examples/simple.js b/examples/simple.js new file mode 100644 index 0000000..4727b05 --- /dev/null +++ b/examples/simple.js @@ -0,0 +1,20 @@ +'use strict'; + +//require('letsencrypt-express') +require('../').create({ + + server: 'staging' + +, email: 'aj@daplie.com' + +, agreeTos: true + +, approvedDomains: [ 'pokemap.hellabit.com', 'www.pokemap.hellabit.com' ] + +, app: require('express')().use('/', function (req, res) { + res.end('Hello, World!'); + }) + +, debug: true + +}).listen(80, 443); diff --git a/lex.js b/lex.js index 6804003..9b0d7d9 100644 --- a/lex.js +++ b/lex.js @@ -28,7 +28,8 @@ module.exports.create = function (opts) { plainPorts.forEach(function (p) { promises.push(new PromiseA(function (resolve, reject) { - require('http').createServer(le.middleware(require('https-redirect').create())).listen(p, function () { + require('http').createServer(le.middleware(require('redirect-https')())).listen(p, function () { + console.log("Handling ACME challenges and redirecting to https on plain port " + p); resolve(); }).on('error', reject); })); @@ -37,6 +38,7 @@ module.exports.create = function (opts) { ports.forEach(function (p) { promises.push(new PromiseA(function (resolve, reject) { var server = require('https').createServer(le.httpsOptions, le.middleware(le.app)).listen(p, function () { + console.log("Handling ACME challenges and serving https " + p); resolve(); }).on('error', reject); servers.push(server); diff --git a/package.json b/package.json index 7db92a6..14a0b96 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "le-challenge-fs": "^2.0.4", "le-sni-auto": "^2.0.1", "le-store-certbot": "^2.0.3", - "letsencrypt": "^2.0.4", + "letsencrypt": "^2.1.0", "localhost.daplie.com-certificates": "^1.2.3", "redirect-https": "^1.1.0" },