refactor(frontend): share Clerk publishable-key heuristic across client+server

This commit is contained in:
Ishan (OpenClaw)
2026-02-07 10:09:21 +00:00
parent 795f40e50b
commit fd954238ea
4 changed files with 32 additions and 19 deletions

View File

@@ -1,7 +1,10 @@
import { NextResponse } from "next/server";
import { clerkMiddleware } from "@clerk/nextjs/server";
const isClerkEnabled = () => Boolean(process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY);
import { isLikelyValidClerkPublishableKey } from "@/auth/clerkKey";
const isClerkEnabled = () =>
isLikelyValidClerkPublishableKey(process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY);
export default isClerkEnabled() ? clerkMiddleware() : () => NextResponse.next();