|
|
|
@ -15,7 +15,7 @@ var versions = {
|
|
|
|
|
|
|
|
|
|
function ServerInfoController() {
|
|
|
|
|
this.healthConfig = global.environment.health || {};
|
|
|
|
|
this.healthCheck = new HealthCheck();
|
|
|
|
|
this.healthCheck = new HealthCheck(global.environment.disabled_file);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = ServerInfoController;
|
|
|
|
@ -37,13 +37,12 @@ ServerInfoController.prototype.version = function(req, res) {
|
|
|
|
|
ServerInfoController.prototype.health = function(req, res) {
|
|
|
|
|
if (!!this.healthConfig.enabled) {
|
|
|
|
|
var startTime = Date.now();
|
|
|
|
|
this.healthCheck.check(this.healthConfig, function(err, result) {
|
|
|
|
|
this.healthCheck.check(this.healthConfig, function(err) {
|
|
|
|
|
var ok = !err;
|
|
|
|
|
var response = {
|
|
|
|
|
enabled: true,
|
|
|
|
|
ok: ok,
|
|
|
|
|
elapsed: Date.now() - startTime,
|
|
|
|
|
result: result
|
|
|
|
|
elapsed: Date.now() - startTime
|
|
|
|
|
};
|
|
|
|
|
if (err) {
|
|
|
|
|
response.err = err.message;
|
|
|
|
|