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

Allow opening other files, not just .env #66

Closed
nvtkaszpir opened this issue Mar 19, 2019 · 3 comments · Fixed by #77

Comments

@nvtkaszpir
Copy link
Contributor

commented Mar 19, 2019

Currently environs read only hard-coded .env files, and only path is available.
Yet more and more tools allow custom .env files.

I believe environs should add parameter like file='.env' to be able to override defaults.

@c-w

This comment has been minimized.

Copy link
Contributor

commented May 15, 2019

Note that it's already possible to read files not called .env when using recurse=False, so perhaps that offers a work-around:

from environs import Env

with open("test.txt", "w") as fobj:
    fobj.write("A=foo\n")
    fobj.write("B=123\n")

env = Env()
env.read_env("test.txt", recurse=False)

assert env("A") == "foo"
assert env.int("B") == 123
@nvtkaszpir

This comment has been minimized.

Copy link
Contributor Author

commented May 15, 2019

Oh right, that's PEBKAC from my point. I was totally not seeing part of the code.

I believe this should be added to the docs as an example.

nvtkaszpir added a commit to nvtkaszpir/environs that referenced this issue May 15, 2019
Expand README wiht example how to read arbitrary env formatted file.
Fixes sloria#66

Special thanks for Clemens Wolff for providing example.
nvtkaszpir added a commit to nvtkaszpir/environs that referenced this issue May 15, 2019
Expand README with example how to read arbitrary env formatted file.
Fixes sloria#66

Special thanks for Clemens Wolff for providing example.

@sloria sloria closed this in #77 May 16, 2019

@sloria

This comment has been minimized.

Copy link
Owner

commented May 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.