Skip to content

fix: respect PostgreSQL port in database connection#123

Merged
brendan-kellam merged 2 commits into
mainfrom
fix/sou-1524-postgresql-port
Jul 20, 2026
Merged

fix: respect PostgreSQL port in database connection#123
brendan-kellam merged 2 commits into
mainfrom
fix/sou-1524-postgresql-port

Conversation

@brendan-kellam

@brendan-kellam brendan-kellam commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • include postgresql.port in DATABASE_HOST when constructing the database connection
  • remove the unsupported DATABASE_PORT environment variable
  • add regression coverage for bundled and external PostgreSQL configurations

Testing

  • helm unittest charts/sourcebot --color
  • helm lint charts/sourcebot -f charts/sourcebot/values.lint.yaml
  • git diff --check

SOU-1524

Closes #122


Note

Medium Risk
Changes deployment-time database connection env vars; misconfiguration could break DB connectivity on upgrade, though behavior aligns with how the app expects the host string.

Overview
Fixes Helm-generated database env so non-default PostgreSQL ports actually reach the app.

DATABASE_HOST is now built via a new sourcebot.postgresql.address helper: hostname plus postgresql.port, unless the host value already includes a port (including bracketed IPv6). The separate DATABASE_PORT env var is removed because entrypoint/DATABASE_URL assembly only used host.

Adds helm unittest cases for bundled Postgres, external host + custom port, and host strings that already contain a port.

Reviewed by Cursor Bugbot for commit 82ea812. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Bug Fixes
    • Updated database connection settings to include the PostgreSQL port directly in the database host value.
    • Improved compatibility with both bundled and externally managed PostgreSQL databases.
    • Removed the separate database port setting from the generated configuration.

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Helm Unit Test Results

18 tests  +3   18 ✅ +3   0s ⏱️ ±0s
 1 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 82ea812. ± Comparison against base commit a11919f.

♻️ This comment has been updated with latest results.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The Helm chart now renders PostgreSQL host and port together in DATABASE_HOST, removes DATABASE_PORT, and tests bundled and external PostgreSQL configurations.

Changes

PostgreSQL connection environment variables

Layer / File(s) Summary
Render and validate DATABASE_HOST with port
charts/sourcebot/templates/_helpers.tpl, charts/sourcebot/tests/basic_test.yaml
DATABASE_HOST now combines the PostgreSQL hostname and port, DATABASE_PORT is removed, and tests cover bundled and external PostgreSQL settings.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The port is moved into DATABASE_HOST and DATABASE_PORT is removed, matching issue #122's requirement.
Out of Scope Changes check ✅ Passed The code changes and added tests stay focused on PostgreSQL connection rendering and introduce no unrelated scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: including the PostgreSQL port in the database connection config.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sou-1524-postgresql-port

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@brendan-kellam
brendan-kellam merged commit 2ed6241 into main Jul 20, 2026
7 checks passed
@brendan-kellam
brendan-kellam deleted the fix/sou-1524-postgresql-port branch July 20, 2026 15:53
@cursor cursor Bot mentioned this pull request Jul 20, 2026
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.

Postgresql port ignored

1 participant