feat(config): warn about legacy Postgres env var usage - #3151
Merged
CommanderStorm merged 13 commits intoAug 24, 2026
Conversation
DATABASE_URL, DEFAULT_SRID, PGSSLCERT, PGSSLKEY and PGSSLROOTCERT are
still read implicitly, but Martin now warns once at startup for each one
that is set, naming the config-file key (and CLI flag, where one exists)
that replaces it. A variable the config file already references via
${VAR} is not reported. Values are never logged.
Existing implicit env-var behavior is unchanged: DATABASE_URL etc. still
configure Postgres exactly as they do today, with or without a config
file. This is a step toward maplibre#1052 without the breaking removal.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
MartinBuilder::with_postgres connects via the DATABASE_URL env var, the same pattern just start/just test-pg use. The new deprecation warning from warn_legacy_env_vars fires on every such test and was tripping assert_log_clean.
Performance Comparison
|
Updated the environment variables documentation to remove deprecated variables and clarify usage. Added a warning about deprecated environment variables.
Contributor
Author
|
@CommanderStorm Thanks for the earlier review. I addressed the feedback and rechecked the final diff/tests; #3151 is ready for another look when you have time. |
CommanderStorm
approved these changes
Aug 24, 2026
CommanderStorm
left a comment
Member
There was a problem hiding this comment.
I cleaned it up a bit, lgtm now
CommanderStorm
enabled auto-merge (squash)
August 24, 2026 13:11
The docker-image e2e job only forwarded an explicit allowlist of env vars into the container, so legacy_postgres_env_vars_warn_in_the_log's DEFAULT_SRID never reached the process and its deprecation warning was never logged. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Open
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.
Summary
Warns once at startup when Martin falls back to one of the five implicit Postgres env vars (
DATABASE_URL,DEFAULT_SRID,PGSSLCERT,PGSSLKEY,PGSSLROOTCERT), naming the config-file key (and CLI flag, where one exists) that replaces it. Split out of #3141 following review from @CommanderStorm, alongside #3150 (the--ssl-cert/--ssl-keyflags).This is a deprecation/migration-warning PR only — all five variables still function exactly as before. The actual breaking removal is deferred to Martin v2 and is not part of this PR.
${VAR}is not reported — it's doing exactly what it should.docs/content/env-vars.mdgets a short deprecation note pointing at Remove automatic ENV var usage except inside config files #1052.Testing
cargo fmt --checkcargo check --workspacecargo test -p martin --lib config::file::main::parse(63 passed)cargo test -p martin --lib config::args::root(9 passed, including a regression test thatDATABASE_URLstill configures Postgres while also warning)cargo clippy -p martin --all-targets -- -D warnings— passes for the changed crate; a pre-existingresult_large_errclippy failure inmartin-core::tiles::postgres::errors(unrelated file, present onmain) blocks a full clean workspace clippy run.