make spdy optional default, lex => glx, update LICENSE
This commit is contained in:
parent
eb996e0cf4
commit
16e1158705
24
LICENSE
24
LICENSE
|
@ -1,6 +1,12 @@
|
||||||
MIT License
|
Copyright 2017 AJ ONeal
|
||||||
|
|
||||||
Copyright (c) 2016 Daplie, Inc
|
This is open source software; you can redistribute it and/or modify it under the
|
||||||
|
terms of either:
|
||||||
|
|
||||||
|
a) the "MIT License"
|
||||||
|
b) the "Apache-2.0 License"
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -19,3 +25,17 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
||||||
|
Apache-2.0 License Summary
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
|
@ -270,7 +270,7 @@ It looks a little more like this:
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// returns an instance of greenlock.js with additional helper methods
|
// returns an instance of greenlock.js with additional helper methods
|
||||||
var lex = require('greenlock-express').create({
|
var glx = require('greenlock-express').create({
|
||||||
server: 'https://acme-v02.api.letsencrypt.org/directory'
|
server: 'https://acme-v02.api.letsencrypt.org/directory'
|
||||||
// Note: If at first you don't succeed, stop and switch to staging:
|
// Note: If at first you don't succeed, stop and switch to staging:
|
||||||
// https://acme-staging-v02.api.letsencrypt.org/directory
|
// https://acme-staging-v02.api.letsencrypt.org/directory
|
||||||
|
@ -322,7 +322,7 @@ function approveDomains(opts, certs, cb) {
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// handles acme-challenge and redirects to https
|
// handles acme-challenge and redirects to https
|
||||||
require('http').createServer(lex.middleware(require('redirect-https')())).listen(80, function () {
|
require('http').createServer(glx.middleware(require('redirect-https')())).listen(80, function () {
|
||||||
console.log("Listening for ACME http-01 challenges on", this.address());
|
console.log("Listening for ACME http-01 challenges on", this.address());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ app.use('/', function (req, res) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// handles your app
|
// handles your app
|
||||||
require('https').createServer(lex.httpsOptions, app).listen(443, function () {
|
require('https').createServer(glx.httpsOptions, app).listen(443, function () {
|
||||||
console.log("Listening for ACME tls-sni-01 challenges and serve app on", this.address());
|
console.log("Listening for ACME tls-sni-01 challenges and serve app on", this.address());
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
@ -357,7 +357,7 @@ The API is actually located at [greenlock.js options](https://git.coolaj86.com/c
|
||||||
The only "API" consists of two options, the rest is just a wrapper around `greenlock.js` to take LOC from 15 to 5:
|
The only "API" consists of two options, the rest is just a wrapper around `greenlock.js` to take LOC from 15 to 5:
|
||||||
|
|
||||||
* `opts.app` An express app in the format `function (req, res) { ... }` (no `next`).
|
* `opts.app` An express app in the format `function (req, res) { ... }` (no `next`).
|
||||||
* `lex.listen(plainPort, tlsPort)` Accepts port numbers (or arrays of port numbers) to listen on.
|
* `glx.listen(plainPort, tlsPort)` Accepts port numbers (or arrays of port numbers) to listen on.
|
||||||
|
|
||||||
Brief overview of some simple options for `greenlock.js`:
|
Brief overview of some simple options for `greenlock.js`:
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
// opts.approveDomains(options, certs, cb)
|
// opts.approveDomains(options, certs, cb)
|
||||||
module.exports.create = function (opts) {
|
module.exports.create = function (opts) {
|
||||||
// accept all defaults for le.challenges, le.store, le.middleware
|
// accept all defaults for greenlock.challenges, greenlock.store, greenlock.middleware
|
||||||
opts._communityPackage = opts._communityPackage || 'greenlock-express.js';
|
opts._communityPackage = opts._communityPackage || 'greenlock-express.js';
|
||||||
var le = require('greenlock').create(opts);
|
var greenlock = require('greenlock').create(opts);
|
||||||
|
|
||||||
opts.app = opts.app || function (req, res) {
|
opts.app = opts.app || function (req, res) {
|
||||||
res.end("Hello, World!\nWith Love,\nGreenlock for Express.js");
|
res.end("Hello, World!\nWith Love,\nGreenlock for Express.js");
|
||||||
|
@ -54,7 +54,7 @@ module.exports.create = function (opts) {
|
||||||
plainPorts.forEach(function (p) {
|
plainPorts.forEach(function (p) {
|
||||||
if (!(parseInt(p, 10) >= 0)) { console.warn("'" + p + "' doesn't seem to be a valid port number for http"); }
|
if (!(parseInt(p, 10) >= 0)) { console.warn("'" + p + "' doesn't seem to be a valid port number for http"); }
|
||||||
promises.push(new PromiseA(function (resolve) {
|
promises.push(new PromiseA(function (resolve) {
|
||||||
require('http').createServer(le.middleware(require('redirect-https')())).listen(p, function () {
|
require('http').createServer(greenlock.middleware(require('redirect-https')())).listen(p, function () {
|
||||||
console.log("Success! Bound to port '" + p + "' to handle ACME challenges and redirect to https");
|
console.log("Success! Bound to port '" + p + "' to handle ACME challenges and redirect to https");
|
||||||
resolve();
|
resolve();
|
||||||
}).on('error', function (e) {
|
}).on('error', function (e) {
|
||||||
|
@ -68,7 +68,14 @@ module.exports.create = function (opts) {
|
||||||
ports.forEach(function (p) {
|
ports.forEach(function (p) {
|
||||||
if (!(parseInt(p, 10) >= 0)) { console.warn("'" + p + "' doesn't seem to be a valid port number for https"); }
|
if (!(parseInt(p, 10) >= 0)) { console.warn("'" + p + "' doesn't seem to be a valid port number for https"); }
|
||||||
promises.push(new PromiseA(function (resolve) {
|
promises.push(new PromiseA(function (resolve) {
|
||||||
var server = require('https').createServer(le.tlsOptions, le.middleware(le.app)).listen(p, function () {
|
var https;
|
||||||
|
try {
|
||||||
|
https = require('spdy');
|
||||||
|
greenlock.tlsOptions.spdy = { protocols: [ 'h2', 'http/1.1' ], plain: false };
|
||||||
|
} catch(e) {
|
||||||
|
https = require('https');
|
||||||
|
}
|
||||||
|
var server = https.createServer(greenlock.tlsOptions, greenlock.middleware(greenlock.app)).listen(p, function () {
|
||||||
console.log("Success! Serving https on port '" + p + "'");
|
console.log("Success! Serving https on port '" + p + "'");
|
||||||
resolve();
|
resolve();
|
||||||
}).on('error', function (e) {
|
}).on('error', function (e) {
|
||||||
|
@ -88,5 +95,5 @@ module.exports.create = function (opts) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return le;
|
return greenlock;
|
||||||
};
|
};
|
|
@ -1,14 +1,13 @@
|
||||||
{
|
{
|
||||||
"name": "greenlock-express",
|
"name": "greenlock-express",
|
||||||
"version": "2.1.5",
|
"version": "2.1.6",
|
||||||
"description": "Free SSL and managed or automatic HTTPS for node.js with Express, Koa, Connect, Hapi, and all other middleware systems.",
|
"description": "Free SSL and managed or automatic HTTPS for node.js with Express, Koa, Connect, Hapi, and all other middleware systems.",
|
||||||
"main": "lex.js",
|
"main": "glx.js",
|
||||||
"homepage": "https://git.coolaj86.com/coolaj86/greenlock-express.js",
|
"homepage": "https://git.coolaj86.com/coolaj86/greenlock-express.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
"example": "examples"
|
"example": "examples"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"acme-v2": "^1.0.7",
|
|
||||||
"greenlock": "^2.2.16",
|
"greenlock": "^2.2.16",
|
||||||
"le-challenge-fs": "^2.0.8",
|
"le-challenge-fs": "^2.0.8",
|
||||||
"le-sni-auto": "^2.1.4",
|
"le-sni-auto": "^2.1.4",
|
||||||
|
|
Loading…
Reference in New Issue