Windshaft-cartodb/lib/monitoring/health-check.js
2019-10-21 19:07:24 +02:00

21 lines
499 B
JavaScript

'use strict';
var fs = require('fs');
function HealthCheck (disableFile) {
this.disableFile = disableFile;
}
module.exports = HealthCheck;
HealthCheck.prototype.check = function (callback) {
fs.readFile(this.disableFile, function handleDisabledFile (err, data) {
var disabledError = null;
if (!err) {
disabledError = new Error(data || 'Unknown error');
disabledError.http_status = 503;
}
return callback(disabledError);
});
};