chore: Better handle the user-provided .env file - #35
Merged
rm3l merged 5 commits intoApr 16, 2025
Merged
Conversation
…the user-specified one as optional Per the Compose spec [1], they they are evaluated in order and can override values set in previous files [1] https://github.com/compose-spec/compose-spec/blob/main/spec.md#env_file
rm3l
force-pushed
the
RHIDP-4263--independent-user-config--better-handling-of-.env
branch
from
March 21, 2025 17:38
bdb3eea to
9a86c30
Compare
Otherwise, the env_file attribute is not used for variable substitution in the compose.yaml file, unless it is is a .env file
rm3l
force-pushed
the
RHIDP-4263--independent-user-config--better-handling-of-.env
branch
from
March 21, 2025 17:52
0837d41 to
7cebea0
Compare
Useless because there is a default fallback value
kadel
approved these changes
Apr 16, 2025
rm3l
deleted the
RHIDP-4263--independent-user-config--better-handling-of-.env
branch
April 16, 2025 16:35
3 tasks
3 tasks
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.
Description
This PR updates the Compose manifest by declaring two
env_files:What's interesting here is that, per the Compose spec [1], the files would be evaluated in order and can override values set in previous files.
This means that the user-provided
.envfile does not need to be an exact copy of the default (previouslyenv.sample), but can just contain overrides for the variables needed (or define new ones).I confirmed this behavior locally with both Podman Compose and Docker Compose.
[1] https://github.com/compose-spec/compose-spec/blob/main/spec.md#env_file
Which issue(s) does this PR fix or relate to
PR acceptance criteria
How to test changes / Special notes to the reviewer
Running
podman compose up -dordocker compose up -dshould work even if there is no local.envfile. The.envfile also does not need to be a copy ofdefault.env- it can just contain the necessary overrides or define extra env vars./cc @kadel @benwilcock