feat: add direct PostgreSQL and ACK deployment support

This commit is contained in:
brother7 committed 2026-08-12 19:20:07 +08:00
1 parent d0192081c7
commit c44274f098
55 files changed
+3317 -1064

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
import { NextResponse } from "next/server";
import { checkDatabaseReadiness, getDatabaseStatus } from "@/lib/server/database";
export const runtime = "nodejs";
const READINESS_TIMEOUT_MS = 3_000;
export async function GET() {
let database: { backend: "local" | "postgres" | "invalid"; configured: boolean };
try {
database = getDatabaseStatus();
} catch {
database = { backend: "invalid", configured: false };
return NextResponse.json({ ok: false, database }, { status: 503 });
}
let timeout: ReturnType<typeof setTimeout> | undefined;
try {
await Promise.race([
checkDatabaseReadiness(),
new Promise<never>((_, reject) => {
timeout = setTimeout(() => reject(new Error("Database readiness timed out")), READINESS_TIMEOUT_MS);
})
]);
return NextResponse.json({ ok: true, database });
} catch {
return NextResponse.json({ ok: false, database }, { status: 503 });
} finally {
if (timeout) clearTimeout(timeout);
}
}