fix(middleware): improve case-insensitive env mode checking

Simplify the local mode detection logic by using toLowerCase() instead
of explicit case matching. This makes the code more robust and handles
any case variation of NEXT_PUBLIC_ENV_MODE consistently.

The setup.py script generates "LOCAL" (uppercase) while developers
might use "local" (lowercase), so this ensures both work reliably.
This commit is contained in:
Frank An 2025-09-11 14:58:12 +08:00
parent fea66b0266
commit a7c11e97c5
No known key found for this signature in database
1 changed files with 1 additions and 1 deletions

View File

@ -66,7 +66,7 @@ export async function middleware(request: NextRequest) {
return NextResponse.redirect(url);
}
const isLocalMode = process.env.NEXT_PUBLIC_ENV_MODE === 'local'
const isLocalMode = process.env.NEXT_PUBLIC_ENV_MODE?.toLowerCase() === 'local'
if (isLocalMode) {
return supabaseResponse;
}