Environment variables
Read and change an app's .env safely.
Each Laravel app has one .env at /home/myapp/shared/.env, linked into every release, so it survives deploys and rollbacks. Cipi writes it at creation with every credential; you add your own keys.
Edit#
cipi app env myapp # opens it in nano, as the app user cipi app env myapp --show [--json] cipi app env myapp --get=APP_URL cipi app env myapp --set=APP_DEBUG=false cipi app env myapp --unset=LEGACY_KEY cipi worker restart myapp # after changing queue or cache drivers
Deploys cache the config, so rebuild it after a change: cipi app artisan myapp config:cache (or deploy). Workers and Octane also need cipi worker restart myapp. Also via REST (GET|PUT /api/apps/{name}/env) and MCP. Custom apps have no .env.
What Cipi writes#
| Variable | Value |
|---|---|
APP_KEY | Generated once at creation |
APP_URL | The domain; switched to https:// by cipi ssl install |
APP_ENV, CIPI_ENV | The environment label (production by default) |
DB_CONNECTION | mysql (MariaDB) or pgsql |
DB_DATABASE, DB_USERNAME, DB_PASSWORD | The app's own database credentials |
CACHE_STORE, SESSION_DRIVER, QUEUE_CONNECTION | database: isolated per app |
REDIS_HOST, REDIS_PORT, REDIS_PASSWORD | The app's own Valkey instance, ready when you switch drivers |
BROADCAST_CONNECTION, REVERB_*, VITE_REVERB_* | Set by cipi app reverb enable |
CIPI_WEBHOOK_TOKEN | Secret that signs deploy webhooks |
CIPI_DEPLOY_BRANCH | Only pushes to this branch deploy |
CIPI_APP_USER | The app's Linux user |
CIPI_MCP | true/false: the app's MCP endpoint |
Change database passwords with cipi app reset-db-password myapp, never by hand: it updates the database and .env together.
Your own keys (Stripe, mail, APIs) go anywhere in the file and are never overwritten by a deploy.
In the web panel#
Edit the .env with secrets masked and changes tracked. The web panel is optional; everything here also works from the CLI.
Common problems#
| Problem | Fix |
|---|---|
| Change ignored | Config is cached by deploys: cipi app artisan myapp config:cache, then cipi worker restart myapp |
| Value with spaces breaks | Quote it: --set='MAIL_FROM_NAME="Acme Shop"' |
The MAC is invalid | APP_KEY changed: restore the old one or set APP_PREVIOUS_KEYS |
Questions#
| Question | Answer |
|---|---|
Is .env in my repository? | Never. It lives in /home/myapp/shared/.env on the server. |
| Who can read it? | The app user and root; API tokens with apps-env. |
| More on secrets? | .env and secrets guide. |