Comparing version 2.0.8 to 2.0.9
@@ -54,2 +54,3 @@ #! /usr/bin/env node | ||
var success = instance.start(function () { | ||
saveSettings(); | ||
list(); | ||
@@ -399,2 +400,8 @@ }); | ||
function portUsed(port, exclude) { | ||
return settings.instances.some(function (instance) { | ||
return instance.id !== exclude && instance.status === 'running' && instance.port === port; | ||
}); | ||
} | ||
function generatePassword() { | ||
@@ -422,9 +429,12 @@ return Math.random().toString(36).slice(-8); | ||
if (!this.port) { | ||
if (settings.instances.length > 0) { | ||
this.port = settings.instances[settings.instances.length - 1].port + 1; | ||
} else { | ||
this.port = 3000; | ||
this.port = 3000; | ||
while(portUsed(this.port)){ | ||
this.port++; | ||
} | ||
} | ||
if (portUsed(this.port)) { | ||
errors.push('port already in use'); | ||
} | ||
if (!this.id) { | ||
@@ -431,0 +441,0 @@ this.id = generateUniqueId(); |
@@ -5,3 +5,3 @@ { | ||
"description": "node logger and monitoring tool", | ||
"version": "2.0.8", | ||
"version": "2.0.9", | ||
"homepage": "https://github.com/paul-em/nogger", | ||
@@ -8,0 +8,0 @@ "author": { |
Sorry, the diff of this file is not supported yet
45451
4403248