From 7750fdc3f2f521720fe267b2de94624817b10adf Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Sat, 22 Jan 2022 21:44:14 -0500 Subject: [PATCH] healthcheck only in k8s --- .gitignore | 1 + app.js | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 9ed71c2..05c16a1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Logs logs *.log +.vscode/ # Runtime data pids diff --git a/app.js b/app.js index a1251b0..cadf23d 100644 --- a/app.js +++ b/app.js @@ -170,10 +170,12 @@ srf.use((req, res, next, err) => { res.send(500); }); -const PORT = process.env.HTTP_PORT || 3000; -const getCount = () => activeCallIds.size; -const healthCheck = require('@jambonz/http-health-check'); -healthCheck({port: PORT, logger, path: '/', fn: getCount}); +if (process.env.K8S) { + const PORT = process.env.HTTP_PORT || 3000; + const getCount = () => activeCallIds.size; + const healthCheck = + healthCheck({port: PORT, logger, path: '/', fn: getCount}); +} /* update call stats periodically */ setInterval(() => {