I\'m trying to set an environment variable for an API key that I don\'t want in my code. My source javascript looks something like this :
.get(`http://api-ur
You can use the Netlify's config file also ... You can find documentation here. Also i wanted to have the same ENV variables with with different values per branch/environment. This workaround worked for me:
Create a netlify.toml file like:
[build]
NUXT_ENV_BASE_API = "/api"
NUXT_ENV_HOST_DOMAIN = "https://your-domain.gr"
[context.branch-deploy]
environment = { NUXT_ENV_BASE_API = "/dev-api", NUXT_ENV_HOST_DOMAIN = "https://dev.your-domain.gr" }
[context.production]
environment = { NUXT_ENV_BASE_API = "/api", NUXT_ENV_HOST_DOMAIN = "https://your-domain.gr" }
And deploy in Netlify ...