From edfa12b8e9ff092b344bc336d1aaadea43950c3c Mon Sep 17 00:00:00 2001 From: Fredrik Johansson Date: Fri, 10 Jul 2026 15:49:56 +0200 Subject: [PATCH] Fix: .env was never actually loaded for local dev MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit README said cp .env.example .env then npm run dev, but nothing ever read the file into process.env — no dotenv, no --env-file. This predates the admin UI work; just surfaced by actually trying to run it. Fixed with Node's native --env-file flag on both dev and start (no new dependency). Doesn't affect Docker, which gets its config from docker-compose's environment: block directly, bypassing npm scripts entirely (CMD calls node dist/index.js directly). Co-Authored-By: Claude Sonnet 5 --- README.md | 2 ++ package.json | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6762e28..bb43a67 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,8 @@ npm install npm run dev ``` +`.env` is loaded via Node's native `--env-file` flag (both `dev` and `start` pass it) — no `dotenv` dependency. Docker doesn't use this at all; the container gets its config from `docker-compose.yml`'s `environment:` block instead, same as before. + ## Environment variables | Variable | Default | Description | diff --git a/package.json b/package.json index 9501924..f83dc4a 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,9 @@ "license": "MIT", "type": "module", "scripts": { - "dev": "tsx watch src/index.ts", + "dev": "tsx watch --env-file=.env src/index.ts", "build": "tsc", - "start": "node dist/index.js" + "start": "node --env-file=.env dist/index.js" }, "dependencies": { "express": "^4.19.2",