feat: improve handling of deployment env vars

These are now defined in Netlify UI for dedicated environments (test, stage, production):

AUTH_URL
NEXTAUTH_URL
PUBLIC_URL

Code now falls back to incoming request host. Mainly used for
deployment previews which do not have Akamai in front, meaning
we do not need the above workaround as incoming request host
matches the actual public facing host. When Akamai is in front,
we lose the public facing host in Netlify's routing layer as they
internally use `x-forwarded-for` and we can't claim it for our usage.
This commit is contained in:
Michael Zetterberg
2024-10-14 20:43:53 +02:00
parent 3a3491c534
commit 4a846540c3
26 changed files with 72 additions and 485 deletions

View File

@@ -4,7 +4,7 @@
"private": true,
"type": "module",
"scripts": {
"prebuild": "npm run update-dotenv && npm run lint && npm run test:unit",
"prebuild": "npm run lint && npm run test:unit",
"build": "next build",
"predev": "rm -rf .next",
"dev": "PORT=3000 NEXT_PUBLIC_PORT=3000 next dev",
@@ -20,7 +20,6 @@
"test:e2e:headless": "start-server-and-test test:setup http://127.0.0.1:3000/en/sponsoring \"cypress run --e2e\"",
"test:setup": "npm run build && npm run start",
"preinstall": "export $(cat .env.local | grep -v '^#' | xargs)",
"update-dotenv": "node update-dotenv.mjs",
"test:unit": "jest",
"test:unit:watch": "jest --watch"
},