The new environment variables experience on Netlify has a couple added features available to try out!
The app UI now enables you to filter variables by scope and/or context:
In this example, the UI shows only environment variables on the “Builds” or “All” scope. It limits these variables to those that have a non-empty value in the “Production” deploy context.
Once filtered, you can use the clipboard button at the top of the list to copy these variables in
.env format. This includes some code comments, so you know what you exported:
# Site environment variables for your-site # Context: production # Scope: builds # Date: 12/16/2022, 12:00:00 AM
You can import an
.env file to another project on Netlify using
netlify env:import on the Netlify CLI.
To use these features, you’ll need the new environment variables experience. The docs describe how to know which experience you have on your Site, and how to migrate to the new experience.
We hope this helps speed up your environment variable management, and welcome any feedback you may have about using variables!