egg-cluster
Advanced tools
Comparing version 1.13.1 to 1.14.0
1.14.0 / 2018-02-05 | ||
================== | ||
**features** | ||
* [[`102a0ad`](http://github.com/eggjs/egg-cluster/commit/102a0adc8577ada8ff8383ba935f7973f215999f)] - feat: https options (#57) (TZ | 天猪 <<atian25@qq.com>>) | ||
1.13.1 / 2018-01-05 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -38,6 +38,7 @@ 'use strict'; | ||
if (options.https) { | ||
server = require('https').createServer({ | ||
key: fs.readFileSync(options.key), | ||
cert: fs.readFileSync(options.cert), | ||
}, app.callback()); | ||
const httpsOptions = Object.assign({}, options.https, { | ||
key: fs.readFileSync(options.https.key), | ||
cert: fs.readFileSync(options.https.cert), | ||
}); | ||
server = require('https').createServer(httpsOptions, app.callback()); | ||
} else { | ||
@@ -44,0 +45,0 @@ server = require('http').createServer(app.callback()); |
@@ -8,4 +8,5 @@ 'use strict'; | ||
const utils = require('egg-utils'); | ||
const is = require('is-type-of'); | ||
const deprecate = require('depd')('egg'); | ||
module.exports = function(options) { | ||
@@ -40,5 +41,14 @@ const defaults = { | ||
// https | ||
if (options.https) { | ||
assert(options.key && fs.existsSync(options.key), 'options.key should exists'); | ||
assert(options.cert && fs.existsSync(options.cert), 'options.cert should exists'); | ||
if (is.boolean(options.https)) { | ||
// TODO: compatible options.key, options.cert, will remove at next major | ||
deprecate('[master] Please use `https: { key, cert }` instead of `https: true`'); | ||
options.https = { | ||
key: options.key, | ||
cert: options.cert, | ||
}; | ||
} | ||
assert(options.https.key && fs.existsSync(options.https.key), 'options.https.key should exists'); | ||
assert(options.https.cert && fs.existsSync(options.https.cert), 'options.https.cert should exists'); | ||
} | ||
@@ -45,0 +55,0 @@ |
{ | ||
"name": "egg-cluster", | ||
"version": "1.13.1", | ||
"version": "1.14.0", | ||
"description": "cluster manager for egg", | ||
@@ -38,2 +38,3 @@ "main": "index.js", | ||
"debug": "^3.1.0", | ||
"depd": "^1.1.2", | ||
"detect-port": "^1.2.1", | ||
@@ -44,2 +45,3 @@ "egg-logger": "^1.6.0", | ||
"graceful-process": "^1.0.0", | ||
"is-type-of": "^1.2.0", | ||
"sendmessage": "^1.1.0", | ||
@@ -46,0 +48,0 @@ "utility": "^1.13.1" |
@@ -53,13 +53,11 @@ # egg-cluster | ||
| Param | Type | Description | | ||
| --------- | --------- | ------------------------ | | ||
| baseDir | `String` | directory of application | | ||
| framework | `String` | specify framework that can be absolute path or npm package | | ||
| plugins | `Object` | plugins for unittest | | ||
| workers | `Number` | numbers of app workers | | ||
| sticky | `Boolean` | sticky mode server | | ||
| port | `Number` | port | | ||
| https | `Boolean` | start a https server | | ||
| key | `String` | ssl key | | ||
| cert | `String` | ssl cert | | ||
| Param | Type | Description | | ||
| ------------ | --------- | ---------------------------------------- | | ||
| baseDir | `String` | directory of application | | ||
| framework | `String` | specify framework that can be absolute path or npm package | | ||
| plugins | `Object` | plugins for unittest | | ||
| workers | `Number` | numbers of app workers | | ||
| sticky | `Boolean` | sticky mode server | | ||
| port | `Number` | port | | ||
| https | `Object` | start a https server, note: `key` / `cert` should be full path to file | | ||
@@ -66,0 +64,0 @@ ## License |
41815
871
12
66
+ Addeddepd@^1.1.2
+ Addedis-type-of@^1.2.0