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
*.log
.vscode/
# Runtime data
pids

4
app.js
View File

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