Apply automatic eslint fixes

This commit is contained in:
Daniel García Aubert
2019-10-21 19:07:24 +02:00
parent 593d9e40f6
commit 4d70ac0894
246 changed files with 11782 additions and 11454 deletions
+10 -12
View File
@@ -2,11 +2,10 @@
var HealthCheck = require('./monitoring/health-check');
var WELCOME_MSG = "This is the CartoDB Maps API, " +
"see the documentation at http://docs.cartodb.com/cartodb-platform/maps-api.html";
var WELCOME_MSG = 'This is the CartoDB Maps API, ' +
'see the documentation at http://docs.cartodb.com/cartodb-platform/maps-api.html';
function ServerInfoController(versions) {
function ServerInfoController (versions) {
this.healthConfig = global.environment.health || {};
this.healthCheck = new HealthCheck(global.environment.disabled_file);
this.versions = versions || {};
@@ -14,24 +13,24 @@ function ServerInfoController(versions) {
module.exports = ServerInfoController;
ServerInfoController.prototype.route = function(monitorRouter) {
ServerInfoController.prototype.route = function (monitorRouter) {
monitorRouter.get('/health', this.health.bind(this));
monitorRouter.get('/', this.welcome.bind(this));
monitorRouter.get('/version', this.version.bind(this));
};
ServerInfoController.prototype.welcome = function(req, res) {
ServerInfoController.prototype.welcome = function (req, res) {
res.status(200).send(WELCOME_MSG);
};
ServerInfoController.prototype.version = function(req, res) {
ServerInfoController.prototype.version = function (req, res) {
res.status(200).send(this.versions);
};
ServerInfoController.prototype.health = function(req, res) {
if (!!this.healthConfig.enabled) {
ServerInfoController.prototype.health = function (req, res) {
if (this.healthConfig.enabled) {
var startTime = Date.now();
this.healthCheck.check(function(err) {
this.healthCheck.check(function (err) {
var ok = !err;
var response = {
enabled: true,
@@ -42,9 +41,8 @@ ServerInfoController.prototype.health = function(req, res) {
response.err = err.message;
}
res.status(ok ? 200 : 503).send(response);
});
} else {
res.status(200).send({enabled: false, ok: true});
res.status(200).send({ enabled: false, ok: true });
}
};