Data

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.

Terminal
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 staging

To 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

Terminal
apprail variables shop                       # names, and where each comes from
apprail variables shop --values              # with values
apprail variables shop --dotenv > .env.local # for local development

In 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

VariableWhenExample
PORTWeb services3000
APPRAIL_SERVICE, APPRAIL_ENVIRONMENT_ID, APPRAIL_RELEASE_ID, APPRAIL_DEPLOYMENT_IDEvery instanceweb
APPRAIL_SERVICE_<NAME>_URLFor each other web service in the project, with _HOST and _PORThttp://api
DATABASE_URLThe environment’s default Postgrespostgres://app:…@…/app?sslmode=disable
REDIS_URLThe default cacheredis://default:…@…:6379
AMQP_URL, RABBITMQ_URLThe default queueamqp://app:…@…:5672
S3_*, AWS_*The default bucketS3_BUCKET=ar-…-uploads
APPRAIL_<KIND>_<NAME>_*Every database, cache, queue, and bucketAPPRAIL_DATABASE_MAIN_URL
APPRAIL_JOB_NAME, APPRAIL_JOB_RUN_IDJob runsnightly-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

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