---
title: Environment Variables
---

Set configuration values for your services without hardcoding them in your code.

## Setting Variables

### Via Dashboard

1. Go to your service → **Variables** tab
2. Enter the key and value
3. Toggle **Secret** if the value should be hidden
4. Click **Add**

### Via CLI

```bash
zevcloud env set <serviceId> DATABASE_URL postgres://...
zevcloud env set <serviceId> API_SECRET sk_live_... --secret
```

### Via API

```bash
curl -X POST https://api.zevcloud.net/v1/services/<serviceId>/env \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"key": "DATABASE_URL", "value": "postgres://...", "isSecret": false}'
```

## Secret Variables

Variables marked as **secret** are:
- **Encrypted at rest** using AES-256
- **Hidden in the dashboard** (shown as `••••••••`)
- **Hidden in CLI output**
- Available to your application at runtime as normal environment variables

> **Tip:**
>
> Always mark database passwords, API keys, and tokens as secret.

## Redeploy After Changes

For **web applications**, environment variable changes take effect on the next deployment. Click **Redeploy** after adding or changing variables.

For **WordPress** and **static sites**, changes take effect immediately (the container reads them on restart).

## System Variables

ZevCloud automatically sets these variables for every service:

| Variable | Description |
|----------|-------------|
| `PORT` | The port your app should listen on |
| `NODE_ENV` | Set to `production` |
| `ZEVCLOUD_URL` | Your app's main address, for example `https://shop.example.com`. A verified custom domain is used when you have one; otherwise your default ZevCloud address. |
| `ZEVCLOUD_FQDN` | Every hostname your app answers on, comma separated, main one first |
| `ZEVCLOUD_SERVICE_ID` | Your service's ID, as shown in the dashboard |
| `ZEVCLOUD_BRANCH` | The Git branch the app was deployed from (Git-based apps) |
| `ZEVCLOUD_PROJECT` | The project name |
| `ZEVCLOUD_ENVIRONMENT` | The environment name, for example `production` |

These are set when your app starts, so they're available at runtime, not during the build. Use them instead of hard-coding your app's address, for example for auth callback URLs or links in emails:

```js
const baseUrl = process.env.ZEVCLOUD_URL; // https://shop.example.com
```

If your app prints its environment, you may also see other variables set by the platform. Use only the `ZEVCLOUD_` names listed here: they are the ones we keep stable.
