mirror of
https://github.com/velocitatem/cvfs.git
synced 2026-05-31 16:53:38 +00:00
Initial commit
This commit is contained in:
16
apps/webapp/middleware.ts
Normal file
16
apps/webapp/middleware.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { type NextRequest, NextResponse } from 'next/server'
|
||||
import { updateSession } from '@/utils/supabase/middleware'
|
||||
|
||||
export async function middleware(request: NextRequest) {
|
||||
// Set NEXT_PUBLIC_REQUIRE_AUTH=true in .env to enable Supabase auth gating
|
||||
if (process.env.NEXT_PUBLIC_REQUIRE_AUTH !== 'true') {
|
||||
return NextResponse.next({ request })
|
||||
}
|
||||
return await updateSession(request)
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
'/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)',
|
||||
],
|
||||
}
|
||||
Reference in New Issue
Block a user