mirror of
https://github.com/theoleuthardt/werkzeugkiste.git
synced 2026-06-13 09:37:53 +00:00
fix: nextjs only reads .env files when using NEXT_PUBLIC_ in front of variables + definition of right .env of root
This commit is contained in:
parent
51befce05d
commit
0d92719258
5 changed files with 20 additions and 3 deletions
2
.env
2
.env
|
|
@ -3,5 +3,5 @@ NODE_ENV=development
|
||||||
HOSTNAME=0.0.0.0
|
HOSTNAME=0.0.0.0
|
||||||
FRONTEND_PORT=3000
|
FRONTEND_PORT=3000
|
||||||
BACKEND_PORT=4000
|
BACKEND_PORT=4000
|
||||||
BACKEND=http://localhost:4000
|
NEXT_PUBLIC_BACKEND_URL=http://localhost:4000
|
||||||
CORS_ALLOWED_ORIGIN=http://localhost:3000
|
CORS_ALLOWED_ORIGIN=http://localhost:3000
|
||||||
|
|
@ -9,7 +9,7 @@ services:
|
||||||
- NODE_ENV=${NODE_ENV}
|
- NODE_ENV=${NODE_ENV}
|
||||||
- HOSTNAME=${HOSTNAME}
|
- HOSTNAME=${HOSTNAME}
|
||||||
- PORT=${FRONTEND_PORT}
|
- PORT=${FRONTEND_PORT}
|
||||||
- BACKEND_URL=${BACKEND}
|
- NEXT_PUBLIC_BACKEND_URL=${NEXT_PUBLIC_BACKEND_URL}
|
||||||
ports:
|
ports:
|
||||||
- "${FRONTEND_PORT}:3000"
|
- "${FRONTEND_PORT}:3000"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
import type { NextConfig } from "next";
|
import type { NextConfig } from "next";
|
||||||
|
import dotenv from "dotenv";
|
||||||
|
|
||||||
|
dotenv.config({ path: "../.env" });
|
||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
output: "standalone",
|
output: "standalone",
|
||||||
env: {
|
env: {
|
||||||
backend_url: process.env.BACKEND_URL || "http://localhost:4000",
|
backend_url: process.env.NEXT_PUBLIC_BACKEND_URL,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
13
frontend/package-lock.json
generated
13
frontend/package-lock.json
generated
|
|
@ -10,6 +10,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
|
"dotenv": "^16.4.7",
|
||||||
"libreoffice-convert": "^1.6.0",
|
"libreoffice-convert": "^1.6.0",
|
||||||
"lucide-react": "^0.475.0",
|
"lucide-react": "^0.475.0",
|
||||||
"next": "15.1.6",
|
"next": "15.1.6",
|
||||||
|
|
@ -1983,6 +1984,18 @@
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/dotenv": {
|
||||||
|
"version": "16.4.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz",
|
||||||
|
"integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==",
|
||||||
|
"license": "BSD-2-Clause",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://dotenvx.com"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/dunder-proto": {
|
"node_modules/dunder-proto": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
|
"dotenv": "^16.4.7",
|
||||||
"libreoffice-convert": "^1.6.0",
|
"libreoffice-convert": "^1.6.0",
|
||||||
"lucide-react": "^0.475.0",
|
"lucide-react": "^0.475.0",
|
||||||
"next": "15.1.6",
|
"next": "15.1.6",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue