From 7fe09935cd10e242eedc34d1f767345246f160ae Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Tue, 9 Oct 2012 18:40:17 +0200 Subject: [PATCH] Restrict listening host to configured ``node_host`` --- app.js | 5 +++-- cluster.js | 6 ++++-- config/environments/development.js.example | 3 ++- package.json | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app.js b/app.js index 21de716b..58c9cf6b 100755 --- a/app.js +++ b/app.js @@ -26,5 +26,6 @@ _.extend(global.settings, env); // kick off controller var app = require(global.settings.app_root + '/app/controllers/app'); -app.listen(global.settings.node_port); -console.log("CartoDB SQL API listening on port " + global.settings.node_port); \ No newline at end of file +app.listen(global.settings.node_port, global.settings.node_host, function() { + console.log("CartoDB SQL API listening on " + global.settings.node_host + ":" + global.settings.node_port); +}); diff --git a/cluster.js b/cluster.js index bc705630..30417979 100755 --- a/cluster.js +++ b/cluster.js @@ -30,11 +30,13 @@ var app = require(global.settings.app_root + '/app/controllers/app'); var cluster = new Cluster({ port: global.settings.node_port, + host: global.settings.node_host, + monHost: global.settings.node_host, monPort: global.settings.node_port+1 }); cluster.listen(function(cb) { cb(app); +}, function() { + console.log("CartoDB SQL API listening on " + global.settings.node_host + ':' + global.settings.node_port); }); - -console.log("CartoDB SQL API listening on port " + global.settings.node_port); diff --git a/config/environments/development.js.example b/config/environments/development.js.example index e18f3a33..17a81cbd 100644 --- a/config/environments/development.js.example +++ b/config/environments/development.js.example @@ -1,4 +1,5 @@ module.exports.node_port = 8080; +module.exports.node_host = '127.0.0.1'; module.exports.environment = 'development'; module.exports.db_base_name = 'cartodb_dev_user_<%= user_id %>_db'; module.exports.db_user = 'development_cartodb_user_<%= user_id %>'; @@ -9,4 +10,4 @@ module.exports.redis_port = 6379; module.exports.redisPool = 50; module.exports.redisIdleTimeoutMillis = 100; module.exports.redisReapIntervalMillis = 10; -module.exports.redisLog = false; \ No newline at end of file +module.exports.redisLog = false; diff --git a/package.json b/package.json index c09f3a2c..fc18f7ed 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "email": "simon@vizzuality.com, strk@vizzuality.com" }, "dependencies": { - "cluster2": "git://github.com/CartoDB/cluster2.git#28cde11", + "cluster2": "git://github.com/CartoDB/cluster2.git#cdb_production", "express": "~2.5.11", "underscore" : "1.1.x", "underscore.string": "1.1.5",