healthcheck only in k8s

This commit is contained in:
Dave Horton
2022-01-22 21:44:14 -05:00
parent fcf90916e1
commit 7750fdc3f2
2 changed files with 7 additions and 4 deletions

1
.gitignore vendored
View File

@@ -1,6 +1,7 @@
# Logs # Logs
logs logs
*.log *.log
.vscode/
# Runtime data # Runtime data
pids pids

10
app.js
View File

@@ -170,10 +170,12 @@ srf.use((req, res, next, err) => {
res.send(500); res.send(500);
}); });
const PORT = process.env.HTTP_PORT || 3000; if (process.env.K8S) {
const getCount = () => activeCallIds.size; const PORT = process.env.HTTP_PORT || 3000;
const healthCheck = require('@jambonz/http-health-check'); const getCount = () => activeCallIds.size;
healthCheck({port: PORT, logger, path: '/', fn: getCount}); const healthCheck =
healthCheck({port: PORT, logger, path: '/', fn: getCount});
}
/* update call stats periodically */ /* update call stats periodically */
setInterval(() => { setInterval(() => {