Unit 9 · Ship it and keep it alive
Why a new environment variable needs a deploy
A build reads the environment variables that existed when it ran. Add a variable after deploying and the live site still lacks it. Set the variable first, then deploy.
The mix-up
What people often think
“Deploy first and add the variable after.”
What the tutor says
A build only sees the variables that existed when it ran. Set the variable, then deploy.
How it works
Your laptop reads its own .env file. The host only knows the variables you set in its dashboard, so “it works on my machine” often means a variable was never added there.
Close cousins of this mix-up
The tutor watches for these in the same lesson.
“If it works on my laptop, the settings are right.”
Your laptop reads .env. The host only knows the variables you set in its dashboard.
Practise it with a tutor watching
Secrets
Respond to a leaked key in the right order: revoke first, then clean up, and know what git remembers.
Free with an account. The first two units need no account.