Comparing version 0.3.7 to 0.3.8
@@ -64,3 +64,5 @@ /* | ||
port: self.options.port, | ||
host: self.options.host || '0.0.0.0', | ||
monPort: self.options.monPort, | ||
monHost: self.options.monHost || '0.0.0.0', | ||
monPath: self.options.monPath, | ||
@@ -102,4 +104,5 @@ ecv: self.options.ecv, | ||
} | ||
var host = self.options.host; | ||
createApp.call(null, function (app) { | ||
app.listen(ports[0], function () { | ||
app.listen(ports[0], host, function () { | ||
if (self.options.ecv) { | ||
@@ -126,4 +129,5 @@ ecv.enable(app, self.options, self, function (data) { | ||
:_.isArray(self.options.port) ? self.options.port : [self.options.port]; | ||
var host = self.options.host; | ||
exitIfBusyPort(ports, ports.length - 1, function(){ | ||
exitIfBusyPort(host, ports, ports.length - 1, function(){ | ||
cb(_.filter(_.isArray(app) ? app : [{app: app, port: self.options.port}], | ||
@@ -137,3 +141,3 @@ function(app){ | ||
function exitIfBusyPort(port, index, cb) { | ||
function exitIfBusyPort(host, port, index, cb) { | ||
if(index < 0) { | ||
@@ -149,4 +153,4 @@ return cb(); | ||
}); | ||
server.listen(port[index], function() { //'listening' listener | ||
exitIfBusyPort(port, index-1, function(){ | ||
server.listen(port[index], host, function() { //'listening' listener | ||
exitIfBusyPort(host, port, index-1, function(){ | ||
server.close(); | ||
@@ -153,0 +157,0 @@ cb(); |
@@ -183,2 +183,3 @@ /* | ||
stats: self.stats, | ||
host: self.options.monHost, | ||
port: self.options.monPort, | ||
@@ -250,3 +251,4 @@ path: self.options.monPath | ||
}); | ||
monitor.listen(this.options.monPort); | ||
var monHost = this.options.monHost || '0.0.0.0'; | ||
monitor.listen(this.options.monPort, monHost); | ||
} | ||
@@ -312,4 +314,5 @@ else { | ||
var ports = _.isArray(app.port) ? app.port : [app.port]; | ||
var host = self.options.host ? self.options.host : '0.0.0.0'; | ||
_.each(ports, function(port) { | ||
app.app.listen(port, function() { | ||
app.app.listen(port, host, function() { | ||
console.log('Worker ' + process.pid + ' listening on ' + port); | ||
@@ -316,0 +319,0 @@ if(self.options.ecv) { |
@@ -8,3 +8,3 @@ { | ||
"name": "cluster2", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"repository": { | ||
@@ -11,0 +11,0 @@ "type": "git", |
@@ -101,2 +101,4 @@ ## What is cluster2 | ||
* `port`: Port number for the app, defaults to `3000`. | ||
* `host`: Hostname or IP for the app listening, defaults to `0.0.0.0`. | ||
* `monHost`: Hostname or IP for the monitor listening, defaults to `0.0.0.0`. | ||
* `monPort`: Port number for the monitor URL, defaults to `3001`. Go to `http://<localhost>:3001` to | ||
@@ -166,3 +168,4 @@ view application logs (whatever is written to a `/logs` dir), and npm dependencies. | ||
cluster: true, | ||
port: 3000 | ||
port: 3000, | ||
host: 'localhost' | ||
}); | ||
@@ -169,0 +172,0 @@ c.on('died', function(pid) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80441
1215
244