-
Notifications
You must be signed in to change notification settings - Fork 394
feat: envFiles in netlify.toml #4321
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @iib0011, you're on 🔥
I suggest keeping this feature limited to the [dev]
block for now, and also name the property envFiles
(to match our naming convention) and communicate this is not only about priority, but also which files to use (if any).
Please let me know what you think
Thanks for following up with the changes @iib0011, add another comment. cli/tests/integration/300.command.dev.test.js Line 162 in 808a54c
|
okay |
@erezrokah should I create a test in each .dev.test file? And can you pls explain to me why there are 8 different test files |
That's a very good question. You can create a test in the file I linked. See more in #4178 for the reason we have many test files |
thanks. I just commited the test |
� Conflicts: � tests/integration/300.command.dev.test.js
@erezrokah It is fixed now |
🚀 |
@erezrokah @iib0011 Tested and it works well. https://docs.netlify.com/configure-builds/file-based-configuration/ This will need to be documented here. |
i was searching on how to load an .env.local with netlify dev. Have nothing found in official documentation. only your report here. So is it usable, or is it future music? |
@awacode21 it's usable since the 9.7.0 release, however, the documentation is lagging behind. As far as I can tell, the docs are not available as a public repo to make PRs to. Note that the priority is highest to lowest; highest on the left of the array, lowest on the right. So a variable defined in an env file will override any conflicting variables in the files to the right of it in the array. [dev]
envFiles = [".env.netlify.local", ".env.netlify"] |
@Soviut thank you for the detailed explanation and your help :-) |
Summary
Fixes #4272
We can now set a list in netlify.toml in the dev section like this
env_files = [ ".env", ".env.local" ]
We can also set
env_files = [ ]
to avoid any env file being injected