# Environment Variables & Configuration

OnCallAlert is configured through environment variables. Server options use the `ONCALLALERT_` prefix (command-line flags in uppercase with hyphens replaced by underscores). The legacy `GOALERT_` prefix is also accepted and takes precedence if both are set.

## Primary Environment Variables

| Variable | Required | Default | Description |
|---|---|---|---|
| `ONCALLALERT_DB_URL` | **Yes** | — | PostgreSQL connection URI (e.g. `postgres://user:pass@host:5432/dbname?sslmode=require`). |
| `ONCALLALERT_PUBLIC_URL` | **Recommended** | — | Fully qualified external URL (e.g. `https://oncall.yourcompany.com`). Used for notification links, SSO callbacks, and license checks. |
| `ONCALLALERT_DATA_ENCRYPTION_KEY` | **Recommended** | — | High-entropy string used to encrypt database secrets at rest. Must remain consistent across restarts. |
| `ONCALLALERT_LISTEN` | No | `0.0.0.0:8080` | Bind address and TCP port for the HTTP/HTTPS server. |
| `ONCALLALERT_DB_URL_NEXT` | No | — | Secondary PostgreSQL connection URI used for zero-downtime database switchover migrations. |
| `ONCALLALERT_API_ONLY` | No | `false` | When `true`, disables background notification dispatchers and engine workers, running only API endpoints. |
| `ONCALLALERT_LOG_JSON` | No | `false` | Output structured JSON logs rather than human-readable text. |
| `ONCALLALERT_VERBOSE` | No | `false` | Enable detailed debug logging. |

## Runtime Configuration in Web UI

Non-infrastructure options (such as SMS/Voice telephony providers, SMTP mail servers, AI providers, OIDC credentials, and Dead-man switches) are configured via the web UI under **Admin &rarr; Config** and stored encrypted in the database.
