- Fix 97 lint errors → 0 (unused imports, params, variables across 40+ files) - Fix i18n key format: colon → dot notation for next-intl compatibility - Add missing i18n keys (routes.application, routes.home, confirm) - Fix module visibility: sidebar now respects per-account DB features - Fix inject function: use dot-notation keys, add collapsed:true defaults - Fix ConfirmDialog: use useTranslations instead of hardcoded German defaults - Fix events page: replace placeholder 'Beschreibung' with proper description - Fix Dockerfile: add NEXT_PUBLIC_CI ARG for Docker builds - Collapse secondary sidebar sections by default for cleaner UX
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { NextResponse } from 'next/server';
|
|
|
|
import { getSupabaseServerAdminClient } from '@kit/supabase/server-admin-client';
|
|
|
|
/**
|
|
* Healthcheck endpoint for the web app. If this endpoint returns a 200, the web app will be considered healthy.
|
|
* If this endpoint returns a 500, the web app will be considered unhealthy.
|
|
* This endpoint can be used by Docker to determine if the web app is healthy and should be restarted.
|
|
*/
|
|
export async function GET() {
|
|
const isDbHealthy = await getSupabaseHealthCheck();
|
|
|
|
return NextResponse.json({
|
|
services: {
|
|
database: isDbHealthy,
|
|
// add other services here
|
|
},
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Quick check to see if the database is healthy by querying the config table
|
|
* @returns true if the database is healthy, false otherwise
|
|
*/
|
|
async function getSupabaseHealthCheck() {
|
|
try {
|
|
const client = getSupabaseServerAdminClient();
|
|
|
|
const { data: _data, error } = await client
|
|
.from('config')
|
|
.select('billing_provider')
|
|
.limit(1)
|
|
.maybeSingle();
|
|
|
|
return !error;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|