diff --git a/lib/core/services.js b/lib/core/services.js index a04f672e..ad2f8c07 100644 --- a/lib/core/services.js +++ b/lib/core/services.js @@ -70,18 +70,23 @@ ServicesMonitor.prototype.check = function() { body += d; }); res.on('end', function() { - var parsed = JSON.parse(body); - if(parsed.Version){ - result.push(("IPFS " + parsed.Version).green); + try{ + var parsed = JSON.parse(body); + if(parsed.Version){ + result.push(("IPFS " + parsed.Version).green); + } + else{ + result.push("IPFS".green); + } } - else{ - result.push("IPFS".green); + catch (e){ + result.push("IPFS".red); } callback(null, result); }); res.on('error', function(err) { self.logger.trace("Check IPFS version error: " + err); - result.push("IPFS".green); + result.push("IPFS".red); callback(null, result); }); }); @@ -93,8 +98,8 @@ ServicesMonitor.prototype.check = function() { }); }, function checkDevServer(result, callback) { - var host = self.serverHost || self.config.webServerConfig.host; - var port = self.serverPort || self.config.webServerConfig.port; + var host = self.config.webServerConfig.host || self.serverHost; + var port = self.config.webServerConfig.port || self.serverPort; self.logger.trace('checkDevServer'); var devServer = 'Webserver (http://' + host + ':' + port + ')'; devServer = (self.runWebserver) ? devServer.green : devServer.red;