Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

listen on a specific interface #82

Merged
merged 3 commits into from

2 participants

Philip Tellis Danny Coates
Philip Tellis

tell node-inspector to bind only to a particular network interface so that we don't open it up to the world unless needed.

Danny Coates
Owner

Hey, sorry it took me so long to look at this. It will be part of the next release

Danny Coates dannycoates merged commit b541de3 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 10, 2012
  1. Philip Tellis

    configure which interface to listen on so that we can avoid opening t…

    bluesmoon authored
    …he debugger to the world if not needed
Commits on Feb 13, 2012
  1. Philip Tellis

    missing "

    bluesmoon authored
  2. Philip Tellis
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 3 deletions.
  1. +9 −0 bin/inspector.js
  2. +2 −1  config.json
  3. +2 −2 lib/debug-server.js
9 bin/inspector.js
View
@@ -14,6 +14,9 @@ process.argv.forEach(function (arg) {
case '--web-port':
options.webPort = parseInt(parts[1], 10);
break;
+ case '--web-host':
+ options.webHost = (parts[1] && parts[1] !== 'null') ? parts[1] : null;
+ break;
default:
console.log('unknown option: ' + parts[0]);
break;
@@ -46,12 +49,18 @@ fs.readFile(path.join(__dirname, '../config.json'), function(err, data) {
if (!config.webPort) {
config.webPort = 8080;
}
+ if (!config.webHost) {
+ config.webHost = null; // null implies listen on all interfaces
+ }
if (!config.debugPort) {
config.debugPort = 5858;
}
if (options.webPort) {
config.webPort = options.webPort;
}
+ if (options.webHost) {
+ config.webHost = options.webHost;
+ }
debugServer = new DebugServer();
debugServer.on('close', function () {
3  config.json
View
@@ -1,6 +1,7 @@
{
"webPort": 8080,
+ "webHost": null,
"debugPort": 5858,
"saveLiveEdit": false,
"hidden": []
-}
+}
4 lib/debug-server.js
View
@@ -48,7 +48,7 @@ function handleWebSocketConnection(socket) {
function handleServerListening() {
console.log(
- 'visit http://0.0.0.0:' +
+ 'visit http://' + (config.webHost || '0.0.0.0') + ':' +
config.webPort +
'/debug?port=' + config.debugPort + ' to start debugging');
}
@@ -68,7 +68,7 @@ DebugServer.prototype.start = function(options) {
ws.sockets.on('connection', handleWebSocketConnection);
this.wsServer = ws;
httpServer.on('listening', handleServerListening);
- httpServer.listen(config.webPort);
+ httpServer.listen(config.webPort, config.webHost);
}
DebugServer.prototype.close = function() {
Something went wrong with that request. Please try again.