Skip to content

chore: consolidate per-app env files into a single .env + runtime host injection#99

Merged
dzhhem merged 11 commits into
masterfrom
refactor/consolidate-env-files
Jun 25, 2026
Merged

chore: consolidate per-app env files into a single .env + runtime host injection#99
dzhhem merged 11 commits into
masterfrom
refactor/consolidate-env-files

Conversation

@dzhhem

@dzhhem dzhhem commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Description

Collapses the env-template sprawl into one .env + one .env.example per app.
Previously each app shipped a local example plus a near-duplicate .docker.example
that differed only in host names — every new variable had to be added in two or three
files and kept in sync by hand.

The single template now targets local (non-Docker) hosts. Docker hosts are injected
at runtime instead of being duplicated:

  • services — Compose environment: overrides (compose.dev.yaml); prod adds
    NODE_ENV + build args (compose.yaml). web: NEXT_PUBLIC_API_URL,
    NEXT_PUBLIC_TELEGRAM_BOT_ID. bot: API_URLapi, REDIS_URLredis.
  • api tests — new scripts/test-env.cjs rewrites DB/Redis/Mongo hosts to the
    Docker service names for :dx test scripts.

Every .env.example is also split into banner-delimited REQUIRED (app won't boot
without these) and OPTIONAL (safe defaults + feature toggles) blocks, so required
vs optional is obvious at a glance. Docs updated to match.

Deleted: apps/*/.env*.docker.example (api, api test, web, bot).
Real .env / .env.docker remain gitignored — only .example files are committed.

Closes #98

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)

How Has This Been Tested?

  • Unit tests (Jest/Vitest)

  • Integration tests

  • Manual testing (screenshots/screencasts encouraged)

  • ran bash dx run test:api:light:dx — host rewrite via scripts/test-env.cjs
    resolves postgres/redis correctly; suite green

  • brought up dev stack (bash dx dev) — api, web, bot connect using Compose
    environment: host overrides from the single .env

  • verified no variables were dropped vs the old templates and that example/test diffs are intended functional lines only

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have documented non-obvious behavior or constraints where necessary
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • (If API) Database migrations have been created and tested
  • (If UI) Changes look good on mobile and desktop

@dzhhem dzhhem requested a review from BODMAT June 25, 2026 20:13
@dzhhem dzhhem self-assigned this Jun 25, 2026
@dzhhem dzhhem merged commit 0e79d24 into master Jun 25, 2026
11 checks passed
@dzhhem dzhhem deleted the refactor/consolidate-env-files branch June 25, 2026 21:43
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.

chore: consolidate per-app env files into a single .env + runtime host injection

2 participants