fix(config): strip matching surrounding quotes from env values - #9
Merged
Conversation
Docker `run --env-file` treats `KEY='value'` as a literal string including the single quotes, unlike shell `source .env`. Similarly, docker-compose `env_file` can inject wrapping quotes into the container environment depending on the parser dialect. Introduce `_clean_env()` that strips whitespace and then removes a matched pair of single or double quotes (value[0] == value[-1]). All `os.getenv()` calls in `Settings.from_env()` and helper functions (`_required`, `_integer`, `_float`, `_cron_hour`, `_configured_weather_providers`) now pass through `_clean_env()`. The cleanup is conservative: unmatched or nested quotes are left intact so legitimate values like tokens ending with a quote are not corrupted.
IceCodeNew
force-pushed
the
shit/docker/env-file
branch
from
July 13, 2026 18:29
94556c1 to
47ae711
Compare
This was referenced Jul 20, 2026
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.
Docker
run --env-filetreatsKEY='value'as a literal string including the single quotes, unlike shellsource .env. Similarly, docker-composeenv_filecan inject wrapping quotes into the container environment depending on the parser dialect.What changed
_clean_env()— strips leading/trailing whitespace, then removes a matched pair of surrounding single or double quotes. Unmatched quotes (e.g. a token legitimately ending with') are left intact.os.getenv()calls inSettings.from_env()and helper functions (_required,_integer,_float,_cron_hour,_configured_weather_providers) now pass through_clean_env().env.examplenow warns against quoting values for Docker compatibility.docs/design.mddocuments the rationale under a new "Environment variable compatibility" section.Tests
Added 8 tests covering single quotes, double quotes, unquoted values, quoted numeric values, empty quoted strings →
None, and unmatched quotes left unchanged.