Environment variable per branch for lambda functions

Hello folks

I want to maintain a development and production instance of my application.
I’m using master and develop branches to do this.
I’ve configured the netlify.toml file like so

[context.production.environment]
A = ‘A’
B= ‘B’
[context.develop.environment]
A = ‘x’
B=‘z’

this is working fine for the react application, however, the functions on the develop branch are still using the environment variables from [context.production.environment]. Is there a different way to update environment variables on develop instance?

Hi @skippednote, at the moment the only environment variables that are available in to Netlify Functions are those you specify in the netlify UI. The ones you have in the netlify.toml won’t be used in your function. We have an open issue to get this correct. Sorry about that!

If you want to dynamically inject variables in to your function then you’ll need to use webpack or write your own script or another library that runs during the build process to interpolate or inject the variables.