Skip to content

support local environment variables and dev-specific settings in netlify.toml, with optional context flag #457

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

Closed
swyxio opened this issue Apr 17, 2019 · 3 comments · Fixed by #714
Assignees
Labels

Comments

@swyxio
Copy link
Contributor

swyxio commented Apr 17, 2019

@DavidWells already has a prototype of this.

related:

@iamskok
Copy link

iamskok commented Jun 10, 2019

@DavidWells Is there any more progress on it? I’d love to see this feature implemented 🤩

@nolessafool nolessafool changed the title local environment variables in netlify.toml, with optional context flag support local environment variables and dev-specific settings in netlify.toml, with optional context flag Jul 1, 2019
@dan-dr
Copy link

dan-dr commented Jul 10, 2019

yeah hope it doesn't sound too harsh but netlify dev is pretty useless in my case if I have to use the admin UI to change environment variables.

Another way to go about it is to check if the environment variables exist already and only use the admin UI ones if they don't.

Is there a workaround someone is aware of?

Edit:
Using this in the meanwhile

const env = require('dotenv').config()
console.log(`dotenv keys: ${Object.keys(env.parsed).join(', ') || 'nothing in .env'}`)
for (let k in env.parsed) {
  process.env[k] = env.parsed[k]
}

@RaeesBhatti RaeesBhatti transferred this issue from netlify/netlify-dev-plugin Aug 12, 2019
@RaeesBhatti RaeesBhatti self-assigned this Aug 12, 2019
@cinderisles
Copy link

As a workaround, set your variable in the UI to the value you want it to be while developing, which Netlify Dev will use. Then use netlify.toml to set up other contexts, which will override the ones in the UI when needed.

[context.production.environment]
  MY_ENV = "something for prod"

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

Successfully merging a pull request may close this issue.

5 participants