Skip to content

fix(env): move inline comments off value lines in .env.example#56

Merged
Musiker15 merged 1 commit into
mainfrom
fix/env-example-inline-comments
May 25, 2026
Merged

fix(env): move inline comments off value lines in .env.example#56
Musiker15 merged 1 commit into
mainfrom
fix/env-example-inline-comments

Conversation

@Musiker15
Copy link
Copy Markdown
Member

Summary

Discovered live during the first production auto-deploy: the .env.example had two values with inline # comment annotations, which systemd EnvironmentFile= does not strip. Result: the app refused to start with

ATTACHMENT_MAX_BYTES: Invalid input: expected number, received NaN

because Number("26214400 # 25 MB") is NaN.

This PR moves both comments to the line above the value:

  • ATTACHMENT_MAX_BYTES — also adds a short footnote explaining the foot-gun so the next contributor doesn't reintroduce it
  • LOG_LEVEL — same treatment, comment-above

Why only these two

grep -nE '^[A-Za-z_].*=.*#' .env.example returns nothing after this PR. The rest of the file either has comments on their own lines already, or empty placeholder values.

Affected setups

  • systemd / EnvironmentFile= (bare-metal Debian, the reference deployment): broken — fixed by this PR
  • Docker --env-file: same parsing semantics as systemd — also broken, also fixed
  • next start with Next.js's built-in dotenv loader: not affected — Next strips inline comments

Test plan

🤖 Generated with Claude Code

systemd's `EnvironmentFile=` parser does NOT strip trailing inline
comments — `KEY=value   # note` is read as the literal value
`value   # note`. For numeric/enum vars this then fails the app's
zod env-schema at startup with errors like:

    ATTACHMENT_MAX_BYTES: Invalid input: expected number, received NaN

Hit this on the first production deploy of mskanban.msk-scripts.de:
the .env had `ATTACHMENT_MAX_BYTES=26214400   # 25 MB` copied
verbatim from this file. Build/migrate/restart all succeeded;
Next.js refused to come up.

Two fields had the foot-gun (`ATTACHMENT_MAX_BYTES` and `LOG_LEVEL`);
moved both comments to the line above the value. Also added a short
note on `ATTACHMENT_MAX_BYTES` explaining why so the next contributor
doesn't reintroduce it.

Next.js' own dotenv loader DOES strip inline comments, so this only
affects deployments where systemd (or any other EnvironmentFile-
based loader) populates the env before the app runs. Docker / `next
start` invocations that go straight through Next's dotenv aren't
affected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Musiker15 <info@musiker15.de>
@Musiker15 Musiker15 merged commit aaab040 into main May 25, 2026
8 checks passed
@Musiker15 Musiker15 deleted the fix/env-example-inline-comments branch May 25, 2026 16:55
Musiker15 added a commit that referenced this pull request May 25, 2026
…#57)

Two changes that ship together because they both prepare the
upcoming v0.2.0-beta tag:

1. **CHANGELOG**: `[Unreleased]` (190 lines, multiple duplicate
   Added/Changed sections) is consolidated and renamed to
   `[0.2.0-beta] — 2026-05-25`. Missing entries for the recent
   #53#56 (URL cleanup, auto-deploy + domain fix + env.example
   inline-comment fix) are added. A fresh `[Unreleased]` placeholder
   sits above. Link references at the bottom updated:
     [Unreleased]: ...compare/v0.2.0-beta...HEAD
     [0.2.0-beta]: ...compare/v0.1.0-beta...v0.2.0-beta

2. **release.yml**: adds an "Extract CHANGELOG section for this
   release" step before softprops/action-gh-release. It uses awk's
   `index()` (not regex) so awk-implementation differences over `\[`
   escaping can't break it, then writes the matching section to
   `release-body.md`. The action's `body_path:` prepends that to
   the auto-generated PR list — best of both: hand-curated
   narrative + complete commit/PR audit trail.

   The step also logs a `::warning::` and falls through to
   auto-only if the CHANGELOG has no matching section, so a future
   tag with no curated notes still produces a release.

Verified locally with `awk -v marker="## [0.2.0-beta]" '...'
CHANGELOG.md` — 53 lines extracted, no leakage from neighbouring
sections.

Signed-off-by: Musiker15 <info@musiker15.de>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant