# Configure Grav with environment variables

Source: https://docs.fortrabbit.com/guides/more/grav-configuration
Published: 2026-10-24
Updated: 2026-10-24
Reviewed: 2026-10-24

> Configure Grav 2 on fortrabbit with ENV vars: GRAV_CONFIG, config paths with double underscores, and configuration per domain.


## Configuration through ENV vars

Grav 2 reads a `.env` file at the project root and accepts configuration overrides from real environment variables, such as the [ENV vars](/platform/settings/env-vars) of a fortrabbit environment. Set `GRAV_CONFIG` to switch the feature on, then map any config path to a variable name by replacing the dots with double underscores:



```raw
GRAV_CONFIG=true
GRAV_CONFIG__system__cache__enabled=true
GRAV_CONFIG__plugins__email__mailer__smtp__password=secret
```

The software preset sets two of these already. `GRAV_CONFIG` is on, and `GRAV_CONFIG__system__errors__display` is `0`, because the shipped `user/config/system.yaml` turns full backtraces on and that file is not replaced by deployments.

Server-set variables win over anything in a `.env` file, so secrets belong in the dashboard rather than in the repo. The shipped `.env.example` documents the remaining options, including the `GRAV_CONFIG_ALIAS__` prefix for plugin slugs containing a hyphen.

## Environment configuration by domain

Grav also reads [configuration per domain](https://learn.getgrav.org/advanced/environment-config). For a site under development locally, debugging is usually wanted there and unwanted on fortrabbit. Create a `system.yaml` for the custom domain, for `www.my-grav.tld` that is `user/www.my-grav.tld/config/system.yaml`:



```yml
debugger:
  enabled: false
```

The stricter approach sets `user/config/system.yaml` as restrictive as possible and keeps a localhost override in `user/localhost/config/system.yaml`:



```yml
debugger:
  enabled: true
```

---

- [Grav install guide](/guides/more/grav)
- [ENV vars](/platform/settings/env-vars)
