refactor(db): parse DSN when defaulting postgres sslmode - #1199
Open
madhavilosetty-intel wants to merge 2 commits into
Open
refactor(db): parse DSN when defaulting postgres sslmode#1199madhavilosetty-intel wants to merge 2 commits into
madhavilosetty-intel wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1199 +/- ##
==========================================
+ Coverage 50.09% 50.14% +0.04%
==========================================
Files 146 147 +1
Lines 13552 13564 +12
==========================================
+ Hits 6789 6801 +12
Misses 6171 6171
Partials 592 592 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors Postgres migration DSN handling to avoid forcing sslmode=disable (and producing malformed URLs) by parsing the DSN and only defaulting sslmode when it’s not explicitly provided.
Changes:
- Added
applySSLModeto parse a Postgres URL and defaultsslmode=disableonly when absent. - Updated hosted DB migration setup to use
applySSLModeinstead of string concatenation. - Added unit tests for
applySSLModeand documented DSN TLS examples in.env.example.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
internal/app/migrate.go |
Introduces applySSLMode and applies it before running Postgres migrations to avoid malformed DSNs and preserve explicit TLS settings. |
internal/app/migrate_test.go |
Adds table-driven tests covering sslmode defaulting/passthrough and malformed URL behavior. |
.env.example |
Adds documentation guidance for Postgres TLS configuration via DB_URL. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
madhavilosetty-intel
force-pushed
the
fix/postgres-migrate-sslmode
branch
from
August 13, 2026 02:52
707af22 to
905aead
Compare
rsdmike
previously approved these changes
Aug 13, 2026
setupHostedDB concatenated "?sslmode=disable" onto DB_URL, which forced plaintext for schema migrations and produced a malformed DSN when the URL already carried a query string. Parse the DSN and only default sslmode when the operator hasn't set one, so verify-full and sslrootcert pass through untouched while the plaintext dev/compose Postgres keeps working.
madhavilosetty-intel
force-pushed
the
fix/postgres-migrate-sslmode
branch
from
August 13, 2026 21:18
905aead to
99703bf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
setupHostedDB concatenated "?sslmode=disable" onto DB_URL, which forced plaintext for schema migrations and produced a malformed DSN when the URL already carried a query string.
Parse the DSN(Data Source Name) and only default sslmode when the operator hasn't set one, so verify-full and sslrootcert pass through untouched while the plaintext dev/compose Postgres keeps working.