Variables
Configuration and secrets for each environment, next to the variables Apprail sets for your data and services — exactly as your code receives them.
Set your own
Variables belong to an environment and apply to every service in it. Values are encrypted at rest.
apprail variables set shop STRIPE_KEY=sk_live_… --env production
apprail variables set shop LOG_LEVEL=debug FEATURE_X=on --env staging
apprail variables unset shop FEATURE_X --env stagingTo keep a secret out of your shell history, give - as the value and pipe it in: pbpaste | apprail variables set shop STRIPE_KEY=-.
Changes take effect on the next deployment of each service. To apply them now, redeploy what’s live: apprail services update shop/web --apply production. (Resources becoming ready or rotating credentials update services automatically; see How data connects.)
See what your app gets
apprail variables shop # names, and where each comes from
apprail variables shop --values # with values
apprail variables shop --dotenv > .env.local # for local developmentIn the console, the Variables page lists your variables and, under Set by Apprail, the generated ones with where each comes from. Values are masked until you press Show, and can be copied either way.
What Apprail sets
| Variable | When | Example |
|---|---|---|
PORT | Web services | 3000 |
APPRAIL_SERVICE, APPRAIL_ENVIRONMENT_ID, APPRAIL_RELEASE_ID, APPRAIL_DEPLOYMENT_ID | Every instance | web |
APPRAIL_SERVICE_<NAME>_URL | For each other web service in the project, with _HOST and _PORT | http://api |
DATABASE_URL | The environment’s default Postgres | postgres://app:…@…/app?sslmode=disable |
REDIS_URL | The default cache | redis://default:…@…:6379 |
AMQP_URL, RABBITMQ_URL | The default queue | amqp://app:…@…:5672 |
S3_*, AWS_* | The default bucket | S3_BUCKET=ar-…-uploads |
APPRAIL_<KIND>_<NAME>_* | Every database, cache, queue, and bucket | APPRAIL_DATABASE_MAIN_URL |
APPRAIL_JOB_NAME, APPRAIL_JOB_RUN_ID | Job runs | nightly-report |
Resource and service names are upper-cased with hyphens turned into underscores: a database called billing-db gives APPRAIL_DATABASE_BILLING_DB_URL.
If names clash
Your value always wins. Set DATABASE_URL yourself and Apprail won’t replace it — useful for pointing at an external database. The console marks a generated variable that one of yours overrides.
Who can see values
| Who | Sees |
|---|---|
| Owners, admins, developers (console or full-access token) | Names and values |
| Viewers, read-only tokens, deploy-only tokens (CI and agents) | Names only |
Values never appear in activity history, build logs, or workspace exports (unless an owner explicitly exports with values from the console).
Variables in previews
Pull-request previews start with no variables unless the service names an environment to copy from; the copy happens once, when the preview opens. See previews.
Generated addresses resolve only inside the environment. --dotenv is handy for your own variables, but a local app can’t reach DATABASE_URL as-is — use apprail databases connect and its local URL instead.