This commit is contained in:
AJ ONeal 2016-08-16 13:05:41 -04:00
parent 86d0f7c4b8
commit 8a689f7b8d
5 changed files with 48 additions and 4 deletions

View File

@ -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 });
}
});

22
examples/force-renew.js Normal file
View File

@ -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);

20
examples/simple.js Normal file
View File

@ -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);

4
lex.js
View File

@ -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);

View File

@ -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"
},