egg-cluster
Advanced tools
Comparing version 2.1.1 to 2.2.0
@@ -38,2 +38,3 @@ 'use strict'; | ||
const port = options.port = options.port || listenConfig.port; | ||
const debugPort = options.debugPort; | ||
const protocol = (httpsOptions.key && httpsOptions.cert) ? 'https' : 'http'; | ||
@@ -76,2 +77,3 @@ | ||
let server; | ||
let debugPortServer; | ||
@@ -84,4 +86,10 @@ // https config | ||
server = require('https').createServer(httpsOptions, app.callback()); | ||
if (debugPort) { | ||
debugPortServer = require('http').createServer(app.callback()); | ||
} | ||
} else { | ||
server = require('http').createServer(app.callback()); | ||
if (debugPort) { | ||
debugPortServer = server; | ||
} | ||
} | ||
@@ -124,2 +132,6 @@ | ||
} | ||
if (debugPortServer) { | ||
debug('listen on debug port: %s', debugPort); | ||
debugPortServer.listen(debugPort); | ||
} | ||
} | ||
@@ -126,0 +138,0 @@ |
@@ -13,2 +13,3 @@ 'use strict'; | ||
const utility = require('utility'); | ||
const terminalLink = require('terminal-link'); | ||
@@ -37,2 +38,3 @@ const Manager = require('./utils/manager'); | ||
* - {Number} [port] listening port, default to 7001(http) or 8443(https) | ||
* - {Number} [debugPort] listening a debug port on http protocol | ||
* - {Object} [https] https options, { key, cert, ca }, full path | ||
@@ -96,4 +98,10 @@ * - {Array|String} [require] will inject into worker/agent process | ||
const stickyMsg = this.options.sticky ? ' with STICKY MODE!' : ''; | ||
const startedURL = terminalLink(this[APP_ADDRESS], this[APP_ADDRESS], { fallback: false }); | ||
this.logger.info('[master] %s started on %s (%sms)%s', | ||
frameworkPkg.name, this[APP_ADDRESS], Date.now() - startTime, stickyMsg); | ||
frameworkPkg.name, startedURL, Date.now() - startTime, stickyMsg); | ||
if (this.options.debugPort) { | ||
const url = getAddress({ port: this.options.debugPort, protocol: 'http' }); | ||
const debugPortURL = terminalLink(url, url, { fallback: false }); | ||
this.logger.info('[master] %s started on %s', frameworkPkg.name, debugPortURL); | ||
} | ||
@@ -106,2 +114,3 @@ const action = 'egg-ready'; | ||
port: this[REAL_PORT], | ||
debugPort: this.options.debugPort, | ||
address: this[APP_ADDRESS], | ||
@@ -108,0 +117,0 @@ protocol: this[PROTOCOL], |
{ | ||
"name": "egg-cluster", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "cluster manager for egg", | ||
@@ -46,2 +46,3 @@ "main": "index.js", | ||
"sendmessage": "^1.1.0", | ||
"terminal-link": "^2.1.1", | ||
"utility": "^1.15.0" | ||
@@ -61,3 +62,4 @@ }, | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.0.4" | ||
"typescript": "^5.0.4", | ||
"urllib": "^3.17.1" | ||
}, | ||
@@ -64,0 +66,0 @@ "engines": { |
@@ -56,2 +56,3 @@ # egg-cluster | ||
| port | `Number` | port | | ||
| debugPort | `Number` | the debug port only listen on http protocol | | ||
| https | `Object` | start a https server, note: `key` / `cert` / `ca` should be full path to file | | ||
@@ -58,0 +59,0 @@ | require | `Array\|String` | will inject into worker/agent process | |
58728
1733
73
15
13
5
+ Addedterminal-link@^2.1.1
+ Addedansi-escapes@4.3.2(transitive)
+ Addedsupports-hyperlinks@2.3.0(transitive)
+ Addedterminal-link@2.1.1(transitive)
+ Addedtype-fest@0.21.3(transitive)