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

Reading from multiple .env files with overriding #136

Closed
json2d opened this issue Feb 14, 2020 · 1 comment
Closed

Reading from multiple .env files with overriding #136

json2d opened this issue Feb 14, 2020 · 1 comment

Comments

@json2d
Copy link

json2d commented Feb 14, 2020

Hey so I was expecting this to work:

# .env
FOO=bar
# dev.env
FOO=baz
env = Env()
env.read_env('.env')
env.read_env('dev.env')

assert env('FOO') != 'bar' and env('FOO') == 'baz', 'dev.env did not override .env'

Any reason we don't like this behavior?

@sloria
Copy link
Owner

sloria commented Oct 31, 2020

You need to pass override=True:

from environs import Env

env = Env()
env.read_env(".env")
env.read_env("dev.env", override=True)

assert env("FOO") != "bar" and env("FOO") == "baz", "dev.env did not override .env"

@sloria sloria closed this as completed Oct 31, 2020
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

No branches or pull requests

2 participants