Files
Windshaft-cartodb/lib/cartodb/monitoring/health_check.js
T
Raul Ochoa 2d3f2667ca Standalone server initial implementation
- no dependency over Windshaft.Server
2015-07-04 20:41:22 +02:00

44 lines
879 B
JavaScript

var fs = require('fs');
var step = require('step');
function HealthCheck() {
}
module.exports = HealthCheck;
HealthCheck.prototype.check = function(config, callback) {
var result = {
redis: {
ok: false
},
mapnik: {
ok: false
},
tile: {
ok: false
}
};
step(
function getManualDisable() {
fs.readFile(global.environment.disabled_file, this);
},
function handleDisabledFile(err, data) {
var next = this;
if (err) {
return next();
}
if (!!data) {
err = new Error(data);
err.http_status = 503;
throw err;
}
},
function handleResult(err) {
callback(err, result);
}
);
};