Environment variables hand settings to your app from outside its code: an API key, a mail password, a feature switch. Your code reads them the usual way (getenv('STRIPE_KEY') or env('STRIPE_KEY') in PHP, process.env.STRIPE_KEY in Node.js), and you change them without a new deploy.
Before you start
- Variables are for sites that run code: PHP (including WordPress) and Node.js apps. A static site doesn't have them.
- The site must be live.
- To add or change variables you need the owner, administrator or developer role, or to be a member of this site. Other roles see the names only. See team roles.
Add a variable
- Open Sites → your site → Configure → Environment variables.
- In the empty row at the bottom of the table, type the name in NEW_NAME and the value in value.
- Leave Secret ticked for passwords and API keys. Untick it for harmless values you want to read back later.
- Press Add. The page confirms "Variable saved — it applies to your app within a minute."
Names are UPPER_SNAKE_CASE and start with a letter: STRIPE_KEY, MAIL_PASSWORD, FEATURE_NEW_CHECKOUT. A value is a single line: line breaks are refused.
Change or remove one
Every variable is a row you edit in place. Type the new value and press Save on that row.
- A secret is never shown again after saving, to anyone. Its box stays empty. To change it, type the whole new value and press Save; pressing Save with the box left blank keeps the stored value.
- To remove a variable, press Remove on its row and confirm with Remove variable.
To stop a variable being secret, untick Secret and type its value again: the stored secret is never shown.
Your app picks up the change within a minute. A Node.js app is restarted to read the new values. A PHP site is reloaded, and the next requests see them. If your code relies on a variable you remove, it may break: check the Logs tab afterwards.
What you can't set
Platform values like APP_KEY and your database connection (DB_*) are managed for you and aren't listed in the table. If you try to add one of them, the portal tells you it "is managed automatically by veldhost and can't be set here". Your app still receives the ones that apply to it (a PHP site gets an APP_KEY, a site with a database gets its DB_* values); you just can't override them.
On a Node.js app, PORT and HOME always come from the platform, and the portal refuses them as names. Your app must listen on process.env.PORT (how Node.js apps run).