Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.env file like crea when using BaseSettings #607

Closed
samuelcolvin opened this issue Jun 20, 2019 · 2 comments
Closed

.env file like crea when using BaseSettings #607

samuelcolvin opened this issue Jun 20, 2019 · 2 comments
Labels
feature request help wanted Pull Request welcome

Comments

@samuelcolvin
Copy link
Member

so secrets can be kept out of git without having to always activate an environment.

samuelcolvin added a commit that referenced this issue Jan 19, 2020
* allow use of a `.env`-style files in BaseSettings (#607)

* address various issues with initial implementation

- allow specifying `_env_file` kwarg in instantiation
  * overrides any `env_file` specified in the `Config` class
- cast `os.environ` as a dict for better consistenty of behavior
- `env_path` should be a `Path` type
- replace `with open()` with `read_text`
- use regex for parsing the dotenv files and throw error on invalid line
- factor out `read_env_file` into separate file for easier testing

* move back into a single file; revert typing changes; use regex better

* pass `_env_file` argument around instead of setting a class attribute

* add dotenv docs

* add dotenv tests

* Add changes file

* Flesh out the docs a bit

* Apply suggestions from @samuelcolvin's code review

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* wrap docs

* add not about priority

* fix tests and imports

* fix tests

* switch to python-dotenv

* cleanup, test example

* more docs tweaks

* typo

* fix tests for dotenv

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
@phy25
Copy link

phy25 commented Jan 23, 2020

Looks like this can be closed since #1011 is merged?

@samuelcolvin
Copy link
Member Author

samuelcolvin commented Jan 24, 2020

Yes, see directly above.

Will be released soon.


Sorry, misread your comment. Closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request help wanted Pull Request welcome
Projects
None yet
Development

No branches or pull requests

2 participants