fix: load ProjectConfiguration deploy-config from .env (#1970)#1971
Merged
Conversation
ProjectConfiguration omitted env_file from its model_config, so deploy-time fields like from_email could not be set via a .env file in development. They only resolved from real OS environment variables (Docker/prod) or from .copier-answers.yml, where non-template keys are silently stripped on copier update. Add env_file=_ENV_FILES to ProjectConfiguration.model_config, matching every sibling settings class (CoreConfiguration, MailSettings, BrandSettings, RateLimitSettings, LocaleDetectionSettings, SecurityHeadersSettings). This makes the .env usage already documented for FROM_EMAIL work in dev too. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
davidpoblador
pushed a commit
that referenced
this pull request
Jun 2, 2026
🤖 I have created a release *beep* *boop* --- ## [10.22.4](v10.22.3...v10.22.4) (2026-06-02) ### Bug Fixes * fast-path worker-health to skip CLI bootstrap ([#1974](#1974)) ([#1977](#1977)) ([ee77f6c](ee77f6c)) * load ProjectConfiguration deploy-config from .env ([#1970](#1970)) ([#1971](#1971)) ([13b67a7](13b67a7)) * negotiate Accept-Language with language-only subtag fallback ([#1973](#1973)) ([#1975](#1975)) ([0738181](0738181)) ### Documentation Updates * warn that backgrounded SSE tabs drop events and document resync ([#1978](#1978)) ([6bb1a91](6bb1a91)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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
Fixes #1970.
ProjectConfigurationdid not setenv_filein itsmodel_config, so deploy-time fields that live on it (notablyfrom_email) could not be configured via a.envfile in development. They only resolved from:.copier-answers.yml, where non-template keys are silently stripped oncopier update— a fragile home for deploy config.Every sibling settings class (
CoreConfiguration,MailSettings,BrandSettings,RateLimitSettings,LocaleDetectionSettings,SecurityHeadersSettings) already declaresenv_file=_ENV_FILES. This change bringsProjectConfigurationin line, soFROM_EMAIL=...in.envworks in dev as the docs already describe.Change
config.py: addenv_file=_ENV_FILEStoProjectConfiguration.model_config.Tests
Added
TestProjectConfigurationEnvFileintest_config.py:test_declares_env_file— guards themodel_configwiring (fails onmain, passes here).test_from_email_loads_from_dotenv—from_emailis read from a.envfile.test_from_email_falls_back_to_default— default preserved with no.env/env var.Verified the structural test fails before the fix and passes after.
Precedence note
When
ProjectConfigurationis built from.copier-answers.ymlviaProjectConfiguration(**yaml_data), init kwargs remain the highest-priority source — so afrom_emailpresent in.copier-answers.ymlstill wins over.env. The.envvalue applies precisely when the key is absent from the questionnaire, which is the scenario the issue wants.Docs
No doc change:
FROM_EMAILin.envis already documented (authentication.md,deployment.md,llms-full.txt). This fix makes the code honor the existing docs.🤖 Generated with Claude Code