Skip to content

fix: document and consolidate DB_* env vars for knexfile - #574

Open
amujapromise9-dev wants to merge 4 commits into
Heliobond:mainfrom
amujapromise9-dev:fix/issue-465-knexfile-ts-reads-five-db-environment-variables
Open

fix: document and consolidate DB_* env vars for knexfile#574
amujapromise9-dev wants to merge 4 commits into
Heliobond:mainfrom
amujapromise9-dev:fix/issue-465-knexfile-ts-reads-five-db-environment-variables

Conversation

@amujapromise9-dev

Copy link
Copy Markdown

Overview

This PR fixes the undocumented DB_* environment variables in src/knexfile.ts by adding DB_HOST, DB_PORT, DB_NAME, DB_USER, and DB_PASSWORD to .env.example and docs/SETUP.md, and routing them through src/config.ts — the codebase's single module for environment configuration. This makes the migration system's Postgres connection settings visible, configurable, and consistent with every other environment variable in the app.

Related Issue

Closes #

Changes

📝 Environment Variable Documentation

  • [ADD] .env.example

    • Adds DB_HOST, DB_PORT, DB_NAME, DB_USER, and DB_PASSWORD with sensible defaults/placeholders for local Postgres development.
  • [ADD] docs/SETUP.md

    • Adds the five DB_* variables to the "Environment Variables Reference" table with descriptions and example values.

🔧 Config Consolidation

  • [MODIFY] src/config.ts

    • Adds DB_HOST, DB_PORT, DB_NAME, DB_USER, and DB_PASSWORD fields to the config object, following the existing pattern used by PORT, RPC_URL, etc.
  • [MODIFY] src/knexfile.ts

    • Replaces direct process.env.DB_* reads with the consolidated config module, so all environment configuration flows through a single source of truth.

Verification Results

$ grep -n "DB_HOST\|DB_PORT\|DB_NAME\|DB_USER\|DB_PASSWORD" .env.example src/config.ts docs/SETUP.md
✅ All five DB_* vars now present in all three files

$ npm test
✅ 64/64 passed
Acceptance Criteria Status
DB_HOST/DB_PORT/DB_NAME/DB_USER/DB_PASSWORD documented in .env.example ✅ Added with sensible defaults/placeholders
DB_* variables added to docs/SETUP.md environment variable table ✅ Documented with descriptions and example values
DB_* variables routed through src/config.ts ✅ Config exports db settings; knexfile.ts consumes them
Migration system behavior unchanged getKnexInstance() produces identical Postgres config from consolidated source

Closes #465

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@amujapromise9-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

knexfile.ts reads five DB_* environment variables that are undocumented in .env.example, config.ts, and SETUP.md

1 participant