Docs cipi.yml Web panel API MCP Guides Compare GitHub Telegram channel
  1. Docs
  2. Apps
  3. Environment variables

Environment variables

Read and change an app's .env safely.

Apps

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#

bash
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#

VariableValue
APP_KEYGenerated once at creation
APP_URLThe domain; switched to https:// by cipi ssl install
APP_ENV, CIPI_ENVThe environment label (production by default)
DB_CONNECTIONmysql (MariaDB) or pgsql
DB_DATABASE, DB_USERNAME, DB_PASSWORDThe app's own database credentials
CACHE_STORE, SESSION_DRIVER, QUEUE_CONNECTIONdatabase: isolated per app
REDIS_HOST, REDIS_PORT, REDIS_PASSWORDThe app's own Valkey instance, ready when you switch drivers
BROADCAST_CONNECTION, REVERB_*, VITE_REVERB_*Set by cipi app reverb enable
CIPI_WEBHOOK_TOKENSecret that signs deploy webhooks
CIPI_DEPLOY_BRANCHOnly pushes to this branch deploy
CIPI_APP_USERThe app's Linux user
CIPI_MCPtrue/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#

ProblemFix
Change ignoredConfig is cached by deploys: cipi app artisan myapp config:cache, then cipi worker restart myapp
Value with spaces breaksQuote it: --set='MAIL_FROM_NAME="Acme Shop"'
The MAC is invalidAPP_KEY changed: restore the old one or set APP_PREVIOUS_KEYS

Questions#

QuestionAnswer
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.