Conversation
…through ## The Issue `web_environment` entries without a value (e.g. `- MY_VAR`) were silently dropped by `EnvToUniqueEnv`, so the docker-compose host environment passthrough feature never worked, even though docker-compose supports it natively. ## How This PR Solves The Issue `EnvToUniqueEnv` now stores the full original entry string keyed by variable name, rather than requiring `=` to be present. Bare names pass through as-is to docker-compose, which resolves them from the host environment at container start time. The `fmt` import is removed as it is no longer needed. Test cases are added for bare variable names and for override precedence (last entry wins regardless of whether it is bare or `KEY=value`). Documentation in `customization-extendibility.md` is updated to describe the bare variable passthrough syntax. ## Manual Testing Instructions - Add a bare variable name to `web_environment` in `.ddev/config.yaml`: `web_environment: [MY_HOST_VAR]` - Set `MY_HOST_VAR=hello` in the host shell - Run `ddev restart && ddev exec env | grep MY_HOST_VAR` - Expect: `MY_HOST_VAR=hello` ## Automated Testing Overview `TestEnvToUniqueEnv` in `pkg/ddevapp/config_merge_test.go` is extended with cases for bare variable names and override precedence. ## Release/Deployment Notes Backwards compatible. Existing `KEY=value` entries are unaffected. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Download the artifacts for this pull request:
See Testing a PR. |
stasadev
approved these changes
Mar 16, 2026
Member
stasadev
left a comment
There was a problem hiding this comment.
Looks good to me.
Add a bare variable name to
web_environmentin.ddev/config.yaml
This already worked in v1.25.1.
And I was only able to reproduce this with web_environment in .ddev/config.<something>.yaml.
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.
The Issue
web_environmentanddb_environmententries without a value (e.g.- MY_VAR) were silently dropped byEnvToUniqueEnv, so docker-compose's host environment passthrough feature never worked, even though docker-compose supports it natively.How This PR Solves The Issue
EnvToUniqueEnvnow stores the full original entry string keyed by variable name, rather than requiring=to be present. Bare names pass through as-is to docker-compose, which resolves them from the host environment at container start time. Thefmtimport is removed as it is no longer needed.Test cases are added for bare variable names and for override precedence (last entry wins regardless of whether it is bare or
KEY=value).Documentation in
customization-extendibility.mdis updated to describe the bare variable passthrough syntax.Manual Testing Instructions
web_environmentin.ddev/config.yaml:MY_HOST_VAR=helloin the host shellddev restart && ddev exec env | grep MY_HOST_VARMY_HOST_VAR=helloAutomated Testing Overview
TestEnvToUniqueEnvinpkg/ddevapp/config_merge_test.gois extended with cases for bare variable names and override precedence.Release/Deployment Notes
Backwards compatible. Existing
KEY=valueentries are unaffected.Co-Authored-By: Claude Sonnet 4.6 [email protected]