Skip to content

feat(confi): load .env from CONFI_PATH or current directory - #934

Open
sameer-soni wants to merge 1 commit into
permitio:masterfrom
sameer-soni:feat/configurable-env-folder-201
Open

feat(confi): load .env from CONFI_PATH or current directory#934
sameer-soni wants to merge 1 commit into
permitio:masterfrom
sameer-soni:feat/configurable-env-folder-201

Conversation

@sameer-soni

Copy link
Copy Markdown

Fixes Issue

Closes #201

Changes proposed

Confi used decouple's global config, which only looks for .env / settings.ini next to the
importing module — so there was no way to keep the config file in another folder.

It now builds its own AutoConfig that reads from CONFI_PATH when set, and otherwise the current
working directory:

config = AutoConfig(os.environ.get("CONFI_PATH") or os.getcwd())

(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, and CONFI_PATH taking precedence over the cwd.

Check List (Check all the applicable boxes)

  • I sign off on contributing this submission to open-source
  • My code follows the code style of this project.
  • My change requires changes to the documentation.
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • This PR does not contain plagiarized content.
  • The title of my pull request is a short description of the requested changes.

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 note
about CONFI_PATH to the docs if you'd like it mentioned there.

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
@netlify

netlify Bot commented Jul 22, 2026

Copy link
Copy Markdown

Deploy Preview for opal-docs canceled.

Name Link
🔨 Latest commit b5473c0
🔍 Latest deploy log https://app.netlify.com/projects/opal-docs/deploys/6a600a06e04c320008fe74de

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support .env config from other folders

1 participant