Create env variable that will determine the root of http requests made to backend

site names:

  1. quentertain
    https://www.quentertain.com
  2. quentertain-backend
    https://www.quentertain-backend.netlify.app

As the title says I want to have an env variable that will change depending on the environment. When I’m developing I want it to have the value of localhost:9000 while when I deploy I want it to assume the value https://quentertain-backend.netlify.app (which is basically the backend of my web app).

I created an issue on github that describes exactly the desired result in code, I am just having trouble with the configuration because the env variable set in the settings of the site doesn’t seem to ovverride what I put in my local .env. Any ways to achieve such convenient behaviour or similar?

Thank you so much

Hi @xDavide9

Don’t commit the .env file to GitHub, use it locally only. This way when you deploy to Netlify the value environment variable set in the UI will get used.

1 Like

Thank you so much, it worked! I think that .env was taking priority over gui-set env variable so It was still localhost when deployed. But if there’s no .env in the deploy it can’t be overrided!