Add ability to disable the prisma query in the healthcheck endpoint (#2242)
This commit is contained in:
@@ -930,6 +930,8 @@ const EnvironmentSchema = z.object({
|
||||
|
||||
// CLI package tag (e.g. "latest", "v4-beta", "4.0.0") - used for setup commands
|
||||
TRIGGER_CLI_TAG: z.string().default("latest"),
|
||||
|
||||
HEALTHCHECK_DATABASE_DISABLED: z.string().default("0"),
|
||||
});
|
||||
|
||||
export type Environment = z.infer<typeof EnvironmentSchema>;
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
import { prisma } from "~/db.server";
|
||||
import type { LoaderFunction } from "@remix-run/node";
|
||||
import { env } from "~/env.server";
|
||||
|
||||
export const loader: LoaderFunction = async ({ request }) => {
|
||||
try {
|
||||
if (env.HEALTHCHECK_DATABASE_DISABLED === "1") {
|
||||
return new Response("OK");
|
||||
}
|
||||
|
||||
await prisma.$queryRaw`SELECT 1`;
|
||||
return new Response("OK");
|
||||
} catch (error: unknown) {
|
||||
|
||||
Reference in New Issue
Block a user