feat: force port 3000 to make Next.js abort startup on multiple instances clashing on same port
This commit is contained in:
committed by
Michael Zetterberg
parent
7dc07c256c
commit
b738023a43
@@ -25,3 +25,4 @@ SEAMLESS_LOGIN_FI="http://www.example.fi/updatelogin"
|
||||
SEAMLESS_LOGIN_NO="http://www.example.no/updatelogin"
|
||||
SEAMLESS_LOGIN_SV="http://www.example.se/updatelogin"
|
||||
WEBVIEW_ENCRYPTION_KEY="MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="
|
||||
|
||||
|
||||
8
env/client.ts
vendored
8
env/client.ts
vendored
@@ -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,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -10,6 +10,8 @@ import { transformer } from "@/server/transformer"
|
||||
import { trpc } from "./client"
|
||||
|
||||
function initializeTrpcClient() {
|
||||
// Locally we set nextjs to run on port to 3000 so that we always guarantee
|
||||
// that trpc and next are running on the same port.
|
||||
return trpc.createClient({
|
||||
links: [
|
||||
httpBatchLink({
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"prebuild": "npm run lint",
|
||||
"build": "next build",
|
||||
"predev": "rm -rf .next",
|
||||
"dev": "next dev",
|
||||
"dev": "PORT=3000 NEXT_PUBLIC_PORT=3000 next dev",
|
||||
"prelint": "rm -rf .next",
|
||||
"lint": "next lint --max-warnings 0 && tsc",
|
||||
"prelint:fix": "rm -rf .next",
|
||||
|
||||
Reference in New Issue
Block a user