Open ehmicky opened 3 years ago
I found this issue when I was trying to figure out why my build failed. If this is intentional behaviour, then that's not clear at all.
My specific example was that I had 5 ENV vars total:
CONTENTFUL_SPACE_ID
MASTER_CONTENTFUL_ACCESS_TOKEN
MASTER_CONTENTFUL_ENVIRONMENT_ID
DEV_CONTENTFUL_ACCESS_TOKEN
DEV_CONTENTFUL_ENVIRONMENT_ID
I thought that I had to name them that way since I wanted to differentiate CONTENTFUL_ENVIRONMENT_ID
and CONTENTFUL_ACCESS_TOKEN
based on branch, but now I have renamed the two MASTER
variants to remove that branch name, its fine. 🤷
@adstr123 - do you mean you had to ADD the MASTER_ in to get it to work? Or remove it?
I'm having similar troubles, I'm using the 'suffix' mode for my staging branch, but none of my _STAGING environment variables seems to be injected into my staging environment.
@princefishthrower I had to remove it. I expected to have to put it in there. I'm not sure if this was just my intuition, or if I was swayed that way by the readme - which gives an example of a production
context, which I equated to a master branch...
I looked into this further. It turns out that even though I had the plugin in my package.json
and also in my netlify.toml
as this plugin's README shows, the plugin only started working after activating it in the project's plugin section - which I thought was weird. I'm still trying to figure out when the netlify.toml
settings are actually applied or overridden from other settings set in the UI.
Anyway, I also agree the documentation could be a bit more clear. Something as simple as a sentence like 'for master or production contexts, no context name is needed as a part of the environment variable'.
If a site has an environment variable
PRODUCTION_TEST
, the variable will not be used, even if the branch isproduction
, unless aTEST
environment variable also exists (which might not be the case).