🚀 Add Kubernetes /healthz endpoint

This commit is contained in:
Jan Oberhauser 2019-09-17 15:30:49 +02:00
parent 039d4efafa
commit 0214b44d51

View file

@ -135,7 +135,7 @@ class App {
throw new Error('Basic auth is activated but no password got defined. Please set one!');
}
const authIgnoreRegex = new RegExp(`^\/(rest|${this.endpointWebhook}|${this.endpointWebhookTest})\/.*$`);
const authIgnoreRegex = new RegExp(`^\/(rest|healthz|${this.endpointWebhook}|${this.endpointWebhookTest})\/.*$`);
this.app.use((req: express.Request, res: express.Response, next: express.NextFunction) => {
if (req.url.match(authIgnoreRegex)) {
return next();
@ -188,7 +188,7 @@ class App {
this.app.use(history({
rewrites: [
{
from: new RegExp(`^\/(rest|css|js|${this.endpointWebhook}|${this.endpointWebhookTest})\/.*$`),
from: new RegExp(`^\/(rest|healthz|css|js|${this.endpointWebhook}|${this.endpointWebhookTest})\/?.*$`),
to: (context) => {
return context.parsedUrl!.pathname!.toString();
}
@ -219,6 +219,20 @@ class App {
// ----------------------------------------
// Healthcheck
// ----------------------------------------
// Creates a new workflow
this.app.get('/healthz', ResponseHelper.send(async (req: express.Request, res: express.Response): Promise<IDataObject> => {
return {
status: 'ok',
};
}));
// ----------------------------------------
// Workflow
// ----------------------------------------