@sera4/essentia 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/health/index.js +13 -2
- package/package.json +1 -1
- package/package.tar.gz +0 -0
package/health/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const pathHelper = require("path");
|
|
4
4
|
const logger = require("../logger/s4-logger");
|
|
5
|
+
const lc = require("../last_commit");
|
|
5
6
|
|
|
6
7
|
class HealthCheckError extends Error {
|
|
7
8
|
constructor(m) {
|
|
@@ -31,6 +32,13 @@ class HealthCheck {
|
|
|
31
32
|
|
|
32
33
|
this.defaultPathRoute = `health_check\(.*\)?`
|
|
33
34
|
this.lastCallID = null;
|
|
35
|
+
this.lastCommit = "unknown"
|
|
36
|
+
|
|
37
|
+
// dev versions don't generate this by default
|
|
38
|
+
try {
|
|
39
|
+
this.lastCommit = lc.getLastCommitSync().commit;
|
|
40
|
+
} catch(e) {
|
|
41
|
+
}
|
|
34
42
|
|
|
35
43
|
this.healthChecks = [];
|
|
36
44
|
}
|
|
@@ -86,17 +94,20 @@ class HealthCheck {
|
|
|
86
94
|
|
|
87
95
|
// set this in the header no matter what
|
|
88
96
|
res.setHeader('check', callId)
|
|
97
|
+
res.setHeader('lastCommit', this.lastCommit)
|
|
89
98
|
|
|
90
99
|
if (checkFormat === ".json") {
|
|
100
|
+
const payload = { "check": callId, "commit": this.lastCommit }
|
|
101
|
+
|
|
91
102
|
if (status === 200) {
|
|
92
103
|
res.status(status).json({
|
|
93
|
-
|
|
104
|
+
... payload,
|
|
94
105
|
"healthy":true,
|
|
95
106
|
"message":"success"
|
|
96
107
|
});
|
|
97
108
|
} else {
|
|
98
109
|
res.status(status).json({
|
|
99
|
-
|
|
110
|
+
... payload,
|
|
100
111
|
"healthy": false,
|
|
101
112
|
"message": "fail",
|
|
102
113
|
"services": [result]
|
package/package.json
CHANGED
package/package.tar.gz
CHANGED
|
Binary file
|