Skip to content

Commit 493ca11

Browse files
authored
Add ability to disable the prisma query in the healthcheck endpoint (#2242)
1 parent b36d81a commit 493ca11

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

apps/webapp/app/env.server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,8 @@ const EnvironmentSchema = z.object({
930930

931931
// CLI package tag (e.g. "latest", "v4-beta", "4.0.0") - used for setup commands
932932
TRIGGER_CLI_TAG: z.string().default("latest"),
933+
934+
HEALTHCHECK_DATABASE_DISABLED: z.string().default("0"),
933935
});
934936

935937
export type Environment = z.infer<typeof EnvironmentSchema>;

apps/webapp/app/routes/healthcheck.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import { prisma } from "~/db.server";
22
import type { LoaderFunction } from "@remix-run/node";
3+
import { env } from "~/env.server";
34

45
export const loader: LoaderFunction = async ({ request }) => {
56
try {
7+
if (env.HEALTHCHECK_DATABASE_DISABLED === "1") {
8+
return new Response("OK");
9+
}
10+
611
await prisma.$queryRaw`SELECT 1`;
712
return new Response("OK");
813
} catch (error: unknown) {

0 commit comments

Comments
 (0)