Can anyone offer some advice on how to access environment variables locally using process.env and through Netlify using ${SOME_NETLIFY_VARIABLE} at the same time? Currently I have to manually edit the file between environments.
Thanks @hrishikesh , I’ll definitely look into that.
But is there a way to do it without using Netlify Dev? I’m imagining there’s some sort of logic saying something like “if local, use the auth token on my machine, else if using Netlify, use the env variable”
Well, in most Static Site Generators there’s a way to differentiate between development and production builds, but since this part is not being managed by a SSG, I’m not sure if conditional logic is possible here.
Contexts would be useful if the variables are different between production and development, if I’m not wrong. But, in this case, the variables have the same value, it’s just a difference of how to access them in the code.