@hmcts/nodejs-healthcheck
Advanced tools
Comparing version 1.5.1 to 1.6.0
@@ -1,2 +0,2 @@ | ||
'use strict' | ||
'use strict'; | ||
const checks = require('./checks'), | ||
@@ -6,2 +6,5 @@ outputs = require('./outputs'), | ||
const { Logger } = require('@hmcts/nodejs-logging'); | ||
const logger = Logger.getLogger('@hmcts/nodejs-logging/routes'); | ||
function getBuildInfo(extra) { | ||
@@ -44,2 +47,8 @@ return Promise.all([ | ||
const status = allOk ? 200 : 500; | ||
if (!allOk) { | ||
const downHealthChecks = Object.values(results) | ||
.filter(result => result.status === outputs.DOWN); | ||
logger.error('Health check failed, result for down endpoints: ', JSON.stringify(downHealthChecks)); | ||
} | ||
res.status(status).json(output); | ||
@@ -46,0 +55,0 @@ }); |
@@ -1,5 +0,5 @@ | ||
const fs = require('fs-extra'); | ||
const fs = require('fs').promises; | ||
const yaml = require('js-yaml'); | ||
let defaultObj | ||
let defaultObj; | ||
@@ -18,3 +18,3 @@ const versionFile = () => { | ||
.catch((err) => defaultObj); | ||
} | ||
}; | ||
@@ -33,4 +33,4 @@ const version = () => { | ||
return versionFile().then(props => props.date || defaultObj.date); | ||
} | ||
}; | ||
module.exports = { version, commit, date }; |
'use strict' | ||
const request = require('superagent'), | ||
checks = require('./healthcheck/checks'), | ||
const checks = require('./healthcheck/checks'), | ||
outputs = require('./healthcheck/outputs'), | ||
@@ -9,3 +8,2 @@ routes = require('./healthcheck/routes'), | ||
module.exports = { | ||
@@ -12,0 +10,0 @@ "addTo": install.addTo, |
{ | ||
"name": "@hmcts/nodejs-healthcheck", | ||
"version": "1.5.1", | ||
"version": "1.6.0", | ||
"description": "Healthcheck endpoint for Reform nodejs applications", | ||
"main": "index.js", | ||
"engines": { | ||
"node": ">10.0.0" | ||
}, | ||
"scripts": { | ||
@@ -16,5 +19,5 @@ "test": "mocha test/unit/* --reporter spec" | ||
"dependencies": { | ||
"fs-extra": "^4.0.1", | ||
"@hmcts/nodejs-logging": "^3.0.1", | ||
"js-yaml": "^3.8.4", | ||
"superagent": "^3.5.1" | ||
"superagent": "5" | ||
}, | ||
@@ -24,10 +27,10 @@ "devDependencies": { | ||
"chai-as-promised": "^7.1.1", | ||
"mocha": "^3.4.2", | ||
"nock": "^9.0.0", | ||
"proxyquire": "^1.8.0", | ||
"sinon": "^3.2.0", | ||
"sinon-chai": "^2.10.0", | ||
"supertest": "^3.4.2", | ||
"express": "^4.16.4" | ||
"express": "^4.16.4", | ||
"mocha": "7", | ||
"nock": "12", | ||
"proxyquire": "2", | ||
"sinon": "9", | ||
"sinon-chai": "3", | ||
"supertest": "4" | ||
} | ||
} |
@@ -5,3 +5,3 @@ 'use strict' | ||
const {expect, sinon} = require('../chai-sinon'); | ||
const fs = require('fs-extra'); | ||
const fs = require('fs').promises; | ||
const versionFile = require('../../healthcheck/versionFile'); | ||
@@ -8,0 +8,0 @@ |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
618
27754
20
+ Added@hmcts/nodejs-logging@^3.0.1
+ Added@hmcts/nodejs-logging@3.0.4(transitive)
+ Addedasync@2.6.4(transitive)
+ Addedcolors@1.0.3(transitive)
+ Addedcycle@1.0.3(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addedee-first@1.1.1(transitive)
+ Addedeyes@0.1.8(transitive)
+ Addedfast-safe-stringify@2.1.1(transitive)
+ Addedform-data@3.0.2(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedmime@2.6.0(transitive)
+ Addedmoment@2.30.1(transitive)
+ Addedon-finished@2.4.1(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addedstack-trace@0.0.10(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedsuperagent@5.3.1(transitive)
+ Addedwinston@2.4.7(transitive)
- Removedfs-extra@^4.0.1
- Removedcore-util-is@1.0.3(transitive)
- Removeddebug@3.2.7(transitive)
- Removedextend@3.0.2(transitive)
- Removedform-data@2.5.2(transitive)
- Removedfs-extra@4.0.3(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedisarray@1.0.0(transitive)
- Removedjsonfile@4.0.0(transitive)
- Removedmime@1.6.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedsuperagent@3.8.3(transitive)
- Removeduniversalify@0.1.2(transitive)
Updatedsuperagent@5