Use different backends enpoints for deploy-previews

Hi,

We have a netlify site running on this domain:
app.staging.ramify.fr

We also have a backend hosted on heroku.
For every new pull request on github, we have a feature that deploy a preview backend and make it accessible through an endpoint like app-preview-{{PR-number}}.ramify.fr

We would like to use those endpoints for our deploy-previews on netlify.
For now, our backend endpoint is defined as an environment variable, and we would like it to change for every deploy-preview to something like: app-preview-{{PR-number}}.ramify.fr

I couldn’t find a way to have a dynamic variable that depend on the pull request name / number.

What could be a way to do this?

Any help would be appreciated.

Hey there, @Nils :wave:

Have you tried using REVIEW_ID ? You can read more about all of our environment variables in our Docs: Build environment variables | Netlify Docs

If this doesn’t help, can you please walk me through your use case in a bit more detail? This way I can look into it further for you.

Hey @hillary,

Thanks for your clear answer, it should do the trick.

1 Like

Glad this got you on the right track! Happy building :rocket: