Merged in fix/remove-dynamic-port (pull request #111)

fix: revert dynamically setting port for trpc

Approved-by: Michael Zetterberg
This commit is contained in:
Christel Westerberg
2024-04-24 06:31:03 +00:00
committed by Michael Zetterberg
4 changed files with 10 additions and 3 deletions

View File

@@ -25,3 +25,4 @@ SEAMLESS_LOGIN_FI="http://www.example.fi/updatelogin"
SEAMLESS_LOGIN_NO="http://www.example.no/updatelogin" SEAMLESS_LOGIN_NO="http://www.example.no/updatelogin"
SEAMLESS_LOGIN_SV="http://www.example.se/updatelogin" SEAMLESS_LOGIN_SV="http://www.example.se/updatelogin"
WEBVIEW_ENCRYPTION_KEY="MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=" WEBVIEW_ENCRYPTION_KEY="MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="

8
env/client.ts vendored
View File

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

View File

@@ -10,6 +10,8 @@ import { transformer } from "@/server/transformer"
import { trpc } from "./client" import { trpc } from "./client"
function initializeTrpcClient() { 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({ return trpc.createClient({
links: [ links: [
httpBatchLink({ httpBatchLink({

View File

@@ -7,7 +7,7 @@
"prebuild": "npm run lint", "prebuild": "npm run lint",
"build": "next build", "build": "next build",
"predev": "rm -rf .next", "predev": "rm -rf .next",
"dev": "next dev", "dev": "PORT=3000 NEXT_PUBLIC_PORT=3000 next dev",
"prelint": "rm -rf .next", "prelint": "rm -rf .next",
"lint": "next lint --max-warnings 0 && tsc", "lint": "next lint --max-warnings 0 && tsc",
"prelint:fix": "rm -rf .next", "prelint:fix": "rm -rf .next",