Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/ws-manager-bridge/src/healthz.ts
2498 views
1
/**
2
* Copyright (c) 2024 Gitpod GmbH. All rights reserved.
3
* Licensed under the GNU Affero General Public License (AGPL).
4
* See License.AGPL.txt in the project root for license information.
5
*/
6
7
import * as express from "express";
8
9
export const health = { isHealthy: false };
10
11
export function startHealthEndpoint() {
12
const app = express();
13
const port = 9090;
14
15
app.get("/healthz", (req, res) => {
16
if (health.isHealthy) {
17
res.status(200).send("OK");
18
} else {
19
res.status(503).send("Not ready");
20
}
21
});
22
23
app.listen(port, () => {
24
console.log(`Healthz endpoint running on http://localhost:${port}`);
25
});
26
}
27
28