v2.1.2
This commit is contained in:
parent
b0d9c52c64
commit
665e66263a
29
README.md
29
README.md
|
@ -1,21 +1,8 @@
|
|||
<!-- BANNER_TPL_BEGIN -->
|
||||
|
||||
About Daplie: We're taking back the Internet!
|
||||
--------------
|
||||
|
||||
Down with Google, Apple, and Facebook!
|
||||
|
||||
We're re-decentralizing the web and making it read-write again - one home cloud system at a time.
|
||||
|
||||
Tired of serving the Empire? Come join the Rebel Alliance:
|
||||
|
||||
<a href="mailto:jobs@daplie.com">jobs@daplie.com</a> | [Invest in Daplie on Wefunder](https://daplie.com/invest/) | [Pre-order Cloud](https://daplie.com/preorder/), The World's First Home Server for Everyone
|
||||
|
||||
<!-- BANNER_TPL_END -->
|
||||
|
||||
le-sni-auto
|
||||
===========
|
||||
|
||||
| Sponsored by [ppl](https://ppl.family)
|
||||
|
||||
An auto-sni strategy for registering and renewing letsencrypt certificates using SNICallback.
|
||||
|
||||
This does a couple of rather simple things:
|
||||
|
@ -77,7 +64,7 @@ http.createServer(le.middleware(redirectHttps));
|
|||
|
||||
|
||||
var app = require('express')();
|
||||
https.createServer(le.httpsOptions, le.middleware(app)).listen(443);
|
||||
https.createServer(le.tlsOptions, le.middleware(app)).listen(443);
|
||||
```
|
||||
|
||||
You can also provide a thunk-style `getCertificates(domain, certs, cb)`.
|
||||
|
@ -107,11 +94,11 @@ var leSni = require('le-sni-auto').create({
|
|||
|
||||
// some default certificates that work with localhost
|
||||
// (because default certificates are required as a fallback)
|
||||
var httpsOptions = require('localhost.daplie.com-certificates').merge({
|
||||
var tlsOptions = require('localhost.daplie.me-certificates').merge({
|
||||
SNICallback: leSni.sniCallback
|
||||
});
|
||||
|
||||
https.createServer(httpsOptions, app);
|
||||
https.createServer(tlsOptions, app);
|
||||
```
|
||||
|
||||
You can also provide a thunk-style `getCertificates(domain, certs, cb)`.
|
||||
|
@ -154,14 +141,14 @@ You would set this to `10 * 24 * 60 * 60 * 1000`.
|
|||
.sniCallback()
|
||||
-----------
|
||||
|
||||
This gets passed to `https.createServer(httpsOptions, app)` as `httpsOptions.SNICallback`.
|
||||
This gets passed to `https.createServer(tlsOptions, app)` as `tlsOptions.SNICallback`.
|
||||
|
||||
```javascript
|
||||
var leSni = require('le-sni-auto').create({
|
||||
renewWithin: 10 * 24 * 60 * 60 1000
|
||||
});
|
||||
|
||||
var httpsOptions = require('localhost.daplie.com-certificates').merge({
|
||||
var tlsOptions = require('localhost.daplie.com-certificates').merge({
|
||||
SNICallback: leSni.sniCallback
|
||||
});
|
||||
|
||||
|
@ -169,7 +156,7 @@ function app(req, res) {
|
|||
res.end("Hello, World!");
|
||||
}
|
||||
|
||||
https.createServer(httpsOptions, app);
|
||||
https.createServer(tlsOptions, app);
|
||||
```
|
||||
|
||||
.cacheCerts()
|
||||
|
|
8
index.js
8
index.js
|
@ -4,8 +4,8 @@ var DAY = 24 * 60 * 60 * 1000;
|
|||
var MIN = 60 * 1000;
|
||||
var defaults = {
|
||||
// don't renew before the renewWithin period
|
||||
renewWithin: 7 * DAY
|
||||
, _renewWithinMin: 3 * DAY
|
||||
renewWithin: 14 * DAY
|
||||
, _renewWithinMin: 10 * DAY
|
||||
// renew before the renewBy period
|
||||
, renewBy: 2 * DAY
|
||||
, _renewByMin: Math.floor(DAY / 2)
|
||||
|
@ -148,8 +148,8 @@ module.exports.create = function (autoSni) {
|
|||
promise.then(function (certMeta) {
|
||||
cb(null, certMeta.tlsContext);
|
||||
}, function (err) {
|
||||
console.error('ERROR in le-sni-auto:');
|
||||
console.error(err.stack || err);
|
||||
// console.error('ERROR in le-sni-auto:');
|
||||
// console.error(err.stack || err);
|
||||
cb(err);
|
||||
// don't reuse this promise
|
||||
delete autoSni._ipc[certMeta && certMeta.subject ? certMeta.subject : domain];
|
||||
|
|
10
package.json
10
package.json
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"name": "le-sni-auto",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.2",
|
||||
"description": "An auto-sni strategy for registering and renewing letsencrypt certificates using SNICallback",
|
||||
"homepage": "https://git.coolaj86.com/coolaj86/le-sni-auto.js",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"bluebird": "^3.4.1"
|
||||
|
@ -12,7 +13,7 @@
|
|||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Daplie/le-sni-auto.git"
|
||||
"url": "git+https://git.coolaj86.com/coolaj86/le-sni-auto.git"
|
||||
},
|
||||
"keywords": [
|
||||
"le-sni",
|
||||
|
@ -26,7 +27,6 @@
|
|||
"author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)",
|
||||
"license": "(MIT OR Apache-2.0)",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Daplie/le-sni-auto/issues"
|
||||
},
|
||||
"homepage": "https://github.com/Daplie/le-sni-auto#readme"
|
||||
"url": "https://git.coolaj86.com/coolaj86/le-sni-auto.js/issues"
|
||||
}
|
||||
}
|
||||
|
|
2
test.js
2
test.js
|
@ -86,7 +86,7 @@ var tests = [
|
|||
return require('bluebird').promisify(fn);
|
||||
});
|
||||
|
||||
// opts = { notBefore, notAfter, letsencrypt.renew, letsencrypt.register, httpsOptions }
|
||||
// opts = { notBefore, notAfter, letsencrypt.renew, letsencrypt.register, tlsOptions }
|
||||
var leSni = require('./').create({
|
||||
notBefore: NOT_BEFORE
|
||||
, notAfter: NOT_AFTER
|
||||
|
|
Loading…
Reference in New Issue