feat(confi): load .env from CONFI_PATH or current directory - #934
Open
sameer-soni wants to merge 1 commit into
Open
feat(confi): load .env from CONFI_PATH or current directory#934sameer-soni wants to merge 1 commit into
sameer-soni wants to merge 1 commit into
Conversation
Confi used decouple's global config, which only searches for .env / settings.ini in the importing module's folder. Use a dedicated AutoConfig that reads from CONFI_PATH when set, otherwise the current working directory, so config files can live outside the package. Adds tests covering the CONFI_PATH, cwd-fallback and precedence behaviors (the missing piece from the earlier attempt in permitio#715). Closes permitio#201
✅ Deploy Preview for opal-docs canceled.
|
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.
Fixes Issue
Closes #201
Changes proposed
Confiused decouple's globalconfig, which only looks for.env/settings.ininext to theimporting module — so there was no way to keep the config file in another folder.
It now builds its own
AutoConfigthat reads fromCONFI_PATHwhen set, and otherwise the currentworking directory:
(wrapped in a small
build_config()helper so the behavior can be unit-tested).This is the same approach as #715, which was closed only for missing tests. Added tests for the three
cases: reading from
CONFI_PATH, falling back to the cwd, andCONFI_PATHtaking precedence over the cwd.Check List (Check all the applicable boxes)
Note to reviewers
Picks up where #715 left off, the tests that were missing.
They live in
packages/opal-common/opal_common/tests/test_confi_config_path.py. Happy to add a noteabout
CONFI_PATHto the docs if you'd like it mentioned there.