Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

Update blocks (#580)

Sean Boult3b1d0254ccba
diff --git a/apps/web/global.d.ts b/apps/web/global.d.ts
index cc16e8df..d3dcceab 100644
--- a/apps/web/global.d.ts
+++ b/apps/web/global.d.ts
@@ -13,5 +13,6 @@ declare namespace NodeJS {
PORT: number;
RESEND_API_KEY: string;
EDGE_CONFIG: string;
+ STAGING?: string;
}
}
diff --git a/apps/web/src/middleware.ts b/apps/web/src/middleware.ts
index e2f784da..4eca1bc6 100644
--- a/apps/web/src/middleware.ts
+++ b/apps/web/src/middleware.ts
@@ -1,9 +1,10 @@
import { NextResponse, type NextRequest } from 'next/server';
-const STAGING_DOMAIN = 'web-staging';
export function middleware(req: NextRequest) {
- // skip blocking the request if we are on staging or local
- if (!process.env.VERCEL_ENV || process.env.VERCEL_URL?.includes(STAGING_DOMAIN)) {
+ const { VERCEL_ENV: vercelEnv, STAGING: staging = false } = process.env;
+
+ // skip blocking the request if local or preview or staging
+ if (!vercelEnv || staging) {
return NextResponse.next();
}
diff --git a/turbo.json b/turbo.json
index 83409824..06016996 100644
--- a/turbo.json
+++ b/turbo.json
@@ -6,6 +6,7 @@
"env": [
"VERCEL_URL",
"VERCEL_ENV",
+ "STAGING",
"NODE_ENV",
"DATABASE_URL",
"GITHUB_ID",