Reputation: 430
Basically I have a .env file in the project, however it will be ignored when I commit by git regarding to .gitignore, which also makes it kind of disappear when Netlify deploys this project from GitHub. Then I have to manually set my environment variables on Netlify.
Are there any other ways to do this, so I don't have manually set the environment variables in Netlify and it will read my .env file?
Upvotes: 1
Views: 286
Reputation: 16541
Netlify supports environment variables, not through .env
though. You'll need to configure these either through your dashboard or or in the netlify configuration file.
In the Netlify configuration file. File-based configuration allows you to set different environment variables for different deploy contexts. Variable values set in the configuration file will override values set in the UI.
In your site dashboard under Settings > Build & deploy > Environment > Environment variables. Variable values set under site settings will override the team-level settings.
Upvotes: 2