✨ feat(cli): add --envfile option for runtime environment switching#197
Merged
gaborbernat merged 1 commit intopytest-dev:mainfrom Feb 17, 2026
Merged
✨ feat(cli): add --envfile option for runtime environment switching#197gaborbernat merged 1 commit intopytest-dev:mainfrom
gaborbernat merged 1 commit intopytest-dev:mainfrom
Conversation
53764a0 to
c016e68
Compare
Users needed a way to switch between different environment configurations without modifying config files. This is particularly useful when testing against different environments (dev, staging, prod) or when developers need local overrides without changing version-controlled configuration. Implemented a --envfile CLI argument with two modes. Override mode (--envfile PATH) replaces all configured env_files, while extend mode (--envfile +PATH) adds to them. The CLI file always loads last in extend mode, ensuring its variables take precedence. Unlike config-based env_files which silently skip missing files, CLI files must exist to fail fast on typos or incorrect paths. Restructured README following Diátaxis framework to separate tutorial content (quick start), how-to guides (task-focused), reference (complete API), and explanation (conceptual understanding). This makes the documentation more navigable and helps users find what they need based on their goal. Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
c016e68 to
9a30462
Compare
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.
Developers testing against different environments (dev, staging, prod) had to modify config files or maintain separate configuration files for each environment. This became cumbersome when switching contexts frequently, and risky when accidentally committing local overrides. 🔧
The
--envfileCLI argument provides runtime control over environment files with two modes. Override mode (--envfile PATH) replaces all configuredenv_files, while extend mode (--envfile +PATH) adds to them. The CLI file loads last in extend mode, ensuring its variables take precedence over config files. Unlike config-basedenv_fileswhich silently skip missing files, CLI-specified files must exist, failing fast on typos or incorrect paths.The README has been restructured following the Diátaxis framework to improve navigation. 📚 The new organization separates tutorial content (quick start), task-focused how-to guides, complete reference documentation, and conceptual explanations. This helps users find what they need based on their goal rather than hunting through a single long document.
Fixes #196