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

feature request: support for environment settings specific to [dev] #444

Closed
fool opened this issue Apr 10, 2019 · 10 comments · Fixed by #714
Closed

feature request: support for environment settings specific to [dev] #444

fool opened this issue Apr 10, 2019 · 10 comments · Fixed by #714
Assignees
Labels

Comments

@fool
Copy link
Contributor

fool commented Apr 10, 2019

Request:

folks would like to be able to set dev-specific environment variables via toml file. These should take precedence over the ones set in our Build & Deploy settings admin UI. TBD as to whether they should override locally-set-in-the-shell env vars, I leave that detail up to the implementor. I could see either way making sense!

Requestors:

Netlify's Support team is tracking customers who have requested it. So far just one request in slack (only visible to Netlify employees: https://netlify.slack.com/archives/CC07WN1GC/p1554911472067300)

@swyxio
Copy link
Contributor

swyxio commented Apr 10, 2019

for the record im not taking action on this yet until we all agree on a spec (and document it!)

@dmiyamasu
Copy link

Crossroads (Enterprise plan customer) would like to see this feature added.

@swyxio
Copy link
Contributor

swyxio commented Apr 12, 2019

we've had progress on what we want out of this. .env files will be included as well. i think... https://netlify.slack.com/archives/CGW2Y6XPH/p1555104966005100 cc @philhawksworth

related: https://github.com/netlify/netlify-dev-plugin/issues/60

going to be a mess if we have a bunch of different places to include .env files - may need to just recommend a tool like Kent uses

@DavidChouinard
Copy link

Just wanted to chime in in support of this. Netlify Dev injecting production keys into development environments is a real liability — we're currently counting on devs to locally override env variables in their .bash_profile but it's not a great solution and one of these days we're scared someone might do something destructive because a production key slipped in :(

I'm sure there's a ton on the roadmap but this would mean a lot to us — thanks for the great work.

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

Hey there, want to second that I'm afraid to use netlify dev until it can have its own environmental variables.

Also, feel like we should be allowed to build netlify sites with dotenv entirely, hope that's coming soon as well!

@sami616
Copy link

sami616 commented Nov 18, 2019

Would be great to override env variables specifically when running netlify dev. My use case is connecting to my development database inside a lambda.

Having the option of using a .env file or specific context inside the .toml feels like s nice solution

@fjeddy
Copy link

fjeddy commented Jan 17, 2020

So the only real alternative here is to have duplicate env variables, one for production and one for dev, and then write redundant code to switch between the two depending on what env you're on? :S

It seems odd that this wasn't accounted for when it was made in the first place; I assume very few people use the same variables when developing as live.

@peterjohansson92
Copy link

I agree with @fjeddy

I think that all the env-variables that you add should be treated as a secret. Even though you can add different env-variables to the netlify.toml, it still needs to be located in the repository.

You should be able to add different env-setups in the UI (like you can do in the netlify.toml) or somehow be able to inject it from a 3:rd party through a pre-script.

https://daniel-krzyczkowski.github.io/Access-Azure-Key-Vault-secrets-in-the-Azure-DevOps-Release-Pipelines/

https://daniel-krzyczkowski.github.io/How-to-inject-Azure-Key-Vault-secrets-in-the-Azure-DevOps-CICD-pipelines/

@trevorblades
Copy link

trevorblades commented Feb 11, 2020

@sami616 I posted a comment in a different issue about my solution for this problem. In short, I set _DEV and _PROD environment variables in the Netlify interface, and then conditionally use one over the other based on process.env.NETLIFY_DEV, which is true when you're running netlify dev and false when deploying for production/staging.

setClientSecret(
  process.env.NETLIFY_DEV
    ? process.env.CLIENT_SECRET_DEV
    : process.env.CLIENT_SECRET_PROD
);

Hope this helps! 😄

@fjeddy
Copy link

fjeddy commented Feb 12, 2020

@trevorblades This has already been mentioned, and it doesn't. It's just a workaround, a workaround that shouldn't have to be there.

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.

10 participants