Different variable/api_url for staging branches?

I see with Netlify it’s possible to have every branch become it’s own staging. Currently on our non-Netlify sites we have a separate url/database that staging pulls data from, different than production. Is it possible somehow to set a different variable for staging branches?

Example:
example pulls from api.example
staging–example.com (or any auto test url) pulls from dev.api.example.com

Hi @octoxan,

Sure, you can store the URL in an environment variable, then in your netlify.toml you can set different environment variables for different context (branches). There’s a reference for this in our docs.

1 Like