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 skipping .env autoload #878

Merged
merged 2 commits into from Jan 4, 2022
Merged

Conversation

awarrenlove
Copy link
Contributor

@awarrenlove awarrenlove commented Jan 4, 2022

The feature to automatically load .env files in #845 is nice, but it's a little too greedy in certain situations. Allow skipping that behavior by default (going back to explicit dotenv calls in .envrc files) in the configuration toml file.

@zimbatm zimbatm merged commit f68f741 into direnv:master Jan 4, 2022
@zimbatm
Copy link
Member

zimbatm commented Jan 4, 2022

thanks for the contrib!

@zimbatm
Copy link
Member

zimbatm commented Jan 4, 2022

I might switch the option around tomorrow to make it opt-in instead since it breaks back-compat.

@awarrenlove
Copy link
Contributor Author

Personally I would prefer that, and thought about going that route with this PR, but didn't want to switch default behavior.

@aneeshusa
Copy link
Contributor

Also would really like to make the .env functionality opt-in instead of opt-out!

@shartep
Copy link

shartep commented Mar 15, 2022

my version is 2.30.3:

$ direnv --version
2.30.3

but it still loads .env files by default, what should I do to change this?

@arulrajnet
Copy link

@shartep As per the doc you have to create direnv.toml file in the config directory

mkdir -p ${HOME}/.config/direnv
tee ${HOME}/.config/direnv/direnv.toml <<"EOF"
[global]
skip_dotenv = true
EOF

This works for me.

zimbatm added a commit to zimbatm/direnv that referenced this pull request Mar 26, 2022
Loading the `.env` files is a change in behaviour and broke
backward-compatibility. It sounds really nice at first but it turns out
that many users have .env files littered in their repository and cause a
direnv reload. It's possible to turn that feature off but now they have
one extra step to instruct their users.

This commit inverts the behaviour and turns that feature off by default
to restore back-compat.

See also direnv#878.
zimbatm added a commit to zimbatm/direnv that referenced this pull request Mar 26, 2022
Loading the `.env` files is a change in behaviour and broke
backward-compatibility. It sounds really nice at first but it turns out
that many users have .env files littered in their repository and cause a
direnv reload. It's possible to turn that feature off but now they have
one extra step to instruct their users.

This commit inverts the behaviour and turns that feature off by default
to restore back-compat.

See also direnv#878.
zimbatm added a commit that referenced this pull request Mar 26, 2022
Loading the `.env` files is a change in behaviour and broke
backward-compatibility. It sounds really nice at first but it turns out
that many users have .env files littered in their repository and cause a
direnv reload. It's possible to turn that feature off but now they have
one extra step to instruct their users.

This commit inverts the behaviour and turns that feature off by default
to restore back-compat.

See also #878.
@zimbatm
Copy link
Member

zimbatm commented Mar 26, 2022

Sorry for the back and forth, #911 now inverts the config so that feature isn't enable by default anymore.

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

Successfully merging this pull request may close these issues.

None yet

5 participants