feat: force port 3000 to make Next.js abort startup on multiple instances clashing on same port

This commit is contained in:
Christel Westerberg
2024-04-16 11:37:26 +02:00
committed by Michael Zetterberg
parent 7dc07c256c
commit b738023a43
4 changed files with 10 additions and 3 deletions

8
env/client.ts vendored
View File

@@ -2,7 +2,11 @@ import { createEnv } from "@t3-oss/env-nextjs"
import { z } from "zod"
export const env = createEnv({
client: { NEXT_PUBLIC_PORT: z.string().optional() },
client: {
NEXT_PUBLIC_PORT: z.string().default("3000"),
},
emptyStringAsUndefined: true,
runtimeEnv: { NEXT_PUBLIC_PORT: process.env.PORT },
runtimeEnv: {
NEXT_PUBLIC_PORT: process.env.NEXT_PUBLIC_PORT,
},
})