All systems operational
Cloudphere
← Documentation

Environment variables

Settings and secrets your app reads at runtime, set per environment. Values are encrypted, and saving applies them to the running app.

Add and edit

Open Environment variables for your service. Add one at a time, or switch to the bulk editor to paste a whole .env file. Keys use capital letters, numbers and underscores, for example STRIPE_SECRET_KEY. Production and staging have their own sets.

What happens when you save

Normal variables
The app restarts with the new values, with no downtime.
Build-time variables
Keys starting NEXT_PUBLIC_, VITE_, REACT_APP_, NUXT_PUBLIC_, PUBLIC_ or EXPO_PUBLIC_ are baked into the build, so the app is rebuilt. Your current version keeps running until the new one is live, and Deployment Center shows the result.
During a deploy
Changes are saved and applied as soon as the running build finishes.

Reference another service

Instead of copying a value, point to it. References stay correct when the other value changes:

DATABASE_URL=${{Shop Database.DATABASE_URL}}
REDIS_HOST=${{Shop Redis.REDIS_HOST}}
MAIL_HOST=${{Shop Backend.MAIL_HOST}}

Use the service's name, then a dot, then the key. Besides that service's own variables, every service provides:

Any service
PRIVATE_HOST (its address inside your private network) and PUBLIC_URL.
PostgreSQL and MySQL
DATABASE_URL, DB_CONNECTION, DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD.
Redis
REDIS_URL, REDIS_HOST, REDIS_PORT, REDIS_PASSWORD.

Workers share their service's variables

A background worker added from a service gets a reference to each of that service's variables. A key you add to the service later reaches its workers automatically. A value you set on the worker itself is never overwritten. See Background workers.

Good to know

Staging and pull-request previews don't copy production values. Set what they need on their own environment.