fix health check endpoint

This commit is contained in:
Leon van Zyl
2025-11-30 15:10:42 +02:00
parent ab4d9023a7
commit defba14639
6 changed files with 11 additions and 25 deletions

View File

@@ -1,6 +1,4 @@
import { headers } from "next/headers";
import { NextResponse } from "next/server";
import { auth } from "@/lib/auth";
type StatusLevel = "ok" | "warn" | "error";
@@ -33,15 +31,10 @@ interface DiagnosticsResponse {
overallStatus: StatusLevel;
}
// This endpoint is intentionally public (no auth required) because it's used
// by the setup checklist on the homepage before users are logged in.
// It only returns boolean flags about configuration status, not sensitive data.
export async function GET(req: Request) {
// Require authentication for diagnostics endpoint
const session = await auth.api.getSession({ headers: await headers() });
if (!session) {
return NextResponse.json(
{ error: "Unauthorized. Please sign in to access diagnostics." },
{ status: 401 }
);
}
const env = {
POSTGRES_URL: Boolean(process.env.POSTGRES_URL),
BETTER_AUTH_SECRET: Boolean(process.env.BETTER_AUTH_SECRET),