Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 29 additions & 13 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@ var dashboardApp = require('./app/dashboard/app');
var mongoose = require('./bootstrap');

// configure mongodb
mongoose.connect(config.mongodb.connectionString || 'mongodb://' + config.mongodb.user + ':' + config.mongodb.password + '@' + config.mongodb.server +'/' + config.mongodb.database);
mongoose.connection.on('error', function (err) {
console.error('MongoDB error: ' + err.message);
console.error('Make sure a mongoDB server is running and accessible by this application')
mongoose.connect(
config.mongodb.connectionString
||
'mongodb://' + config.mongodb.user + ':' + config.mongodb.password + '@' + config.mongodb.server +'/' + config.mongodb.database
).catch(function (error) {
if (config.debug) {
console.error('MongoDB error: ' + error.message);
}
console.error('\x1b[31m%s\x1b[0m', 'Make sure a mongoDB server is running and accessible by this application')
});

var a = analyzer.createAnalyzer(config.analyzer);
Expand Down Expand Up @@ -163,19 +168,30 @@ if (!module.parent) {
if (config.server && config.server.port) {
console.error('Warning: The server port setting is deprecated, please use the url setting instead');
port = config.server.port;
} else {
port = serverUrl.port;
if (port === null) {
port = 1337;
}
}
var port = process.env.PORT || port;
var host = process.env.HOST || serverUrl.hostname;
var port = port || serverUrl.port || process.env.PORT;
var host = serverUrl.hostname || process.env.HOST;
server.listen(port, function(){
console.log("Express server listening on host %s, port %d in %s mode", host, port, app.settings.env);
});
server.on('error', function(e) {
server.on('error', function(error) {
if (monitorInstance) {
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;

switch (error.code) {
case 'EACCES':
console.error('\x1b[31m%s\x1b[0m', bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error('\x1b[31m%s\x1b[0m', bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
monitorInstance.stop();
process.exit(1);
}
Expand All @@ -185,4 +201,4 @@ if (!module.parent) {
// monitor
if (config.autoStartMonitor) {
monitorInstance = require('./monitor');
}
}
2 changes: 1 addition & 1 deletion app/api/routes/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module.exports = function(app) {
tags: req.check.tags,
message: req.check.isPaused ? 'paused' : 'restarted'
}).save();
res.redirect(app.route + '/checks/' + req.params.id);
res.redirect(req.baseUrl + '/checks/' + req.params.id);
});
});

Expand Down
21 changes: 17 additions & 4 deletions app/api/routes/ping.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,25 @@ module.exports = function(app) {
if (!check.needsPoll) {
return res.send('Error: This check was already polled. No ping was created', 403);
}

var status = req.body.status === 'true';
Ping.createForCheck(status, req.body.timestamp, req.body.time, check, req.body.name, req.body.error, req.body.details, function(err2, ping) {
if (err2) {
return res.send(err2.message, 500);

Ping.createForCheck({
status,
statusCode:req.body.statusCode,
timestamp: req.body.timestamp,
time: req.body.time,
check,
monitorName: req.body.name,
error: req.body.error,
errorCode: req.body.errorCode,
details: req.body.details,
callback: function(err2, ping) {
if (err2) {
return res.status(500).send(err2.message);
}
res.json(ping);
}
res.json(ping);
});
});
});
Expand Down
106 changes: 0 additions & 106 deletions app/dashboard/public/javascripts/bootstrap-affix.js

This file was deleted.

100 changes: 0 additions & 100 deletions app/dashboard/public/javascripts/bootstrap-button.js

This file was deleted.

7 changes: 7 additions & 0 deletions app/dashboard/public/javascripts/bootstrap.min.js

Large diffs are not rendered by default.

Loading