Skip to content

Commit

Permalink
fail health check until dashboard config is available
Browse files Browse the repository at this point in the history
  • Loading branch information
christianvogt committed Dec 20, 2024
1 parent 4260e3e commit 9b73d1b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions backend/src/routes/api/health/healthUtils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getDashboardConfig } from '../../../utils/resourceUtils';
import { KubeFastifyInstance } from '../../../types';
import { createCustomError } from '../../../utils/requestUtils';

Expand All @@ -7,6 +8,14 @@ export const health = async (fastify: KubeFastifyInstance): Promise<{ health: st
const error = createCustomError('failed to get kube status', 'Failed to get Kube context', 503);
fastify.log.error(error, 'failed to get status');
throw error;
} else if (!getDashboardConfig()) {
const error = createCustomError(
'failed to get dashboard config',
'Failed to get dashboard config',
503,
);
fastify.log.error(error, 'failed to get dashboard config');
throw error;
} else {
return { health: 'ok' };
}
Expand Down

0 comments on commit 9b73d1b

Please sign in to comment.