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

feat(core): add options to disable loading dotenv files #14016

Closed
wants to merge 4 commits into from

Conversation

dschnare
Copy link

Current Behavior

Loading environment variables are loaded by default following this file hierarchy.

Additionally, by default a ".env" file in the current working directly is loaded when using the "nx:run-commands" executor.

Expected Behavior

Default Task Runner

A new option has been added loadDotEnvFiles that can be set to disable any .env file from being loaded. If not set, or explicitly setting to true, then the normal .env file loading behavior takes place.

nx:run-commands

A new option has been added loadDotEnvFile that can be set to disable loading the ".env" file from the current working directory. If not set, then the default loading of the ".env" file is controlled by the task runner option "loadDotEnvFiles". When this option is explicitly set it has precedence over the task runner option loadDotEnvFiles.

If the existing option envFile is set, then the option loadDotEnvFile will be ignored.

Fixes #14010

Add task runner option 'loadDotEnvFiles' to the default task runner.
When this option is false, no .env file as described in the env file
hierarchy of the Nx docs will be loaded. When this option is explicitly
set to true or not set at all, then the .env files will be loaded
normally.

Add option 'loadDotEnvFile' to run-commands.
When this option is false, or the task runner's 'loadDotEnvFiles' is
explicitly set to false, then the ".env" file in the CWD will not be
loaded.
When this option is explicitly set its behaviour will override the
option 'loadDotEnvFiles' from the task runner.
This option will be ignored if the 'envFile' option is present.
When this option is explicitly set to true or not set at all, then
by default the ".env" file from the CWD will be loaded normally.
@vercel
Copy link

vercel bot commented Dec 24, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
nx-dev ✅ Ready (Inspect) Visit Preview Dec 25, 2022 at 8:21PM (UTC)

@dschnare
Copy link
Author

Anyone ever have the CircleCI pipeline fail?

Could not find a usable config.yml, you may have revoked the CircleCI OAuth app.
Please sign out of CircleCI and log back in with your VCS before triggering a new pipeline.

@jaysoo
Copy link
Member

jaysoo commented Mar 3, 2023

Hi @dschnare Thanks for opening the PR. We want to discuss the changes internally and provide a way forward if needed. I'll close this issue since it's not mergeable as is.

Let us know via a new issue or discussion if you want to bring any questions/concerns up. Thanks again!

@jaysoo jaysoo closed this Mar 3, 2023
@github-actions
Copy link

github-actions bot commented Mar 9, 2023

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable loading .env files
3 participants