launchroom
Projects and services

Variables

Config values and secrets per service, targeted per environment or branch, with references between services and encryption at rest.

Variables are the environment your services start with. Each variable is a config value or a secret and applies to one or more environments. Variables can reference other services, so DATABASE_URL in staging points at staging's database without anyone copying a password. launchroom works out which variables the build needs and stores every value encrypted.

Variables tab of the web service: eight variables including references like ${{api.PRIVATE_URL}} resolved to their values, masked secrets with a lock icon, per-environment badges and a broken reference flagged in red.Variables tab of the web service: eight variables including references like ${{api.PRIVATE_URL}} resolved to their values, masked secrets with a lock icon, per-environment badges and a broken reference flagged in red.
Reference other services instead of copying values. Secrets stay masked.

Config and secrets

Every variable has a type:

  • Config: readable by everyone who can see the service. Use it for settings like LOG_LEVEL or APP_URL.
  • Secret: write-only after saving and masked in logs. You can replace it but not read it back. If your role may reveal secrets, Reveal shows the value and records the reveal in the audit log.

When you import variables, keys that usually hold secrets (*_KEY, *_SECRET, *_TOKEN, *PASSWORD*, *_DSN) and values that look like private keys, live API keys or URLs with passwords are suggested as secrets.

Values are stored as written, without trimming or $VAR expansion. Multiline values such as PEM keys work.

Add and import

Open a service's Variables tab and choose Add variable. Type the key and the value; keys that usually hold secrets (STRIPE_SECRET_KEY, DB_PASSWORD) switch Secret on by themselves. Environments and build availability wait under More options. A value that starts or ends with a space or a new line gets a warning, because most apps don't expect one. You can also:

  • Paste a .env file anywhere on the tab, or use Import .env. launchroom shows a preview with conflicts and suggested secrets before saving.
  • Variables as .env: switch to the raw view to edit everything as text. Secrets show as a placeholder that keeps their current value.

Every change is staged and goes live when you apply. Each staged row says whether applying needs a new build or restarts the service with the same build. See Staged changes.

References

A reference inserts another variable's value when the service deploys:

WriteResolves to
${{postgres.DATABASE_URL}}DATABASE_URL of the service with the slug postgres
${{api.PRIVATE_URL}}The private address of api, for example http://api:8000
${{shared.SENTRY_DSN}}A shared variable of the project
${{APP_URL}}Another variable of the same service

Type ${{ in a value field for suggestions. The tab shows each reference's resolved value next to it, with secrets masked.

References resolve per environment. ${{postgres.DATABASE_URL}} in a preview resolves to the preview's own database, so previews and new environments work without editing any variable.

A reference to a service or variable that doesn't exist in this environment is broken. The Variables page flags it in red, and the deploy is refused with the name of every broken reference. launchroom never deploys the literal ${{…}} text. Fix above the table takes you to the broken row, which suggests the references you most likely meant, such as the same variable on another service. Pick one to open the editor with the value already rewritten.

Staged changes sheet with 4 changes and a warning that a broken reference blocks the deploy: web.ANALYTICS_URL refers to a service that does not exist in this environment. Deploy is disabled.Staged changes sheet with 4 changes and a warning that a broken reference blocks the deploy: web.ANALYTICS_URL refers to a service that does not exist in this environment. Deploy is disabled.
A reference to a service that doesn't exist blocks the deploy before it can break production.

Every service exports a few variables you can reference: PRIVATE_HOST (its slug), PRIVATE_URL, PUBLIC_URL, DOMAIN and PORT. Databases also export their connection details, such as DATABASE_URL with its parts for PostgreSQL and MySQL or REDIS_URL for Redis and Valkey (see Managed databases). Connections on the canvas create these references for you.

Generated values

A value that consists of only a generator creates a random secret once, when the variable is saved:

WriteResult
${{ secret(32) }}32 random letters and digits
${{ secret(64, "base64") }}64 random bytes, base64-encoded ("base64url" and "hex" also work)
${{ uuid() }}A random UUID

The length is between 8 and 1024. Generated values are stored as secrets and never change on later deploys. Every environment, including each preview and every copied environment, gets its own value.

Some frameworks can't start without a secret key. When the service doesn't have it, launchroom creates it on the next deploy as a secret variable with a generated value:

FrameworkVariable
LaravelAPP_KEY
DjangoSECRET_KEY, or the variable your settings read it from
Rails, PhoenixSECRET_KEY_BASE
SymfonyAPP_SECRET
Auth.js, NextAuthAUTH_SECRET, or NEXTAUTH_SECRET for NextAuth 4
Next.jsNEXT_SERVER_ACTIONS_ENCRYPTION_KEY

Each environment gets its own value, except NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: it is used while building, so launchroom creates it once per service and copies it to the service's other environments. Promoting a build then keeps server actions working. Fork previews get their own. It is created after the build that asks for it and used from the next build on.

Queue workers and schedulers use their app's key. A generated key is an ordinary variable: reveal, rotate or delete it like any other. A key you set yourself always wins. If you delete the generated one, the next deploy creates a new one, so if you manage the key outside launchroom, remove its "Generate …" chip under Settings → Build → Preset decisions. See the framework guides.

Secrets only you have

Some secrets can't be generated, such as RAILS_MASTER_KEY, which decrypts a Rails app's credentials. When the build finds one missing, the import asks you to paste it, and Settings → Build lists it under Needed before the first deploy with Add as a secret. A deployment without it stops after the build and names the variable.

Targeting

A variable applies to the environments it targets. One row can apply to production and staging at once, for example. When some rows reach beyond the open environment, the table gets an Environments column that names the others, such as "Also staging". Above the table, a count says how many variables there are, and with more than 8 a search field filters by key and visible value. When you edit a row that targets several environments, launchroom asks whether to change it in this environment only (the default, which splits the row) or in every environment of the row.

For previews, target All previews, optionally with Only for preview branches matching a pattern such as feature/*. A branch-specific row wins over the general one. Two rows with the same key and an overlapping target are refused, because the value would be ambiguous.

The final environment of a service is built in this order. Later layers win.

  1. Variables launchroom sets itself (below)
  2. Shared variables the service uses
  3. Variables injected by connections
  4. For workers and cron jobs: the app's variables (below)
  5. The service's variables for this environment
  6. The service's variables for this preview branch

Workers and cron jobs

A worker or cron job runs its app's code, so it gets the app's variables and the variables of the app's connections. Set a value once on the app, and its queue and scheduler use it too. Don't copy variables to them.

  • The worker's Variables page lists the app's variables read-only, marked "From api". Secrets stay masked.
  • To use a different value in the worker, choose Override on that row. This adds a variable with the same key to the worker, which wins over the app's value. A variable or connection the worker has with the same key always wins.
  • References resolve as they do for the app: ${{PUBLIC_URL}} in the app's variable is the app's address, also in the worker.
  • Only runtime variables apply. The worker runs the app's image, so Build only variables don't reach it.
  • When you change one of the app's runtime variables, the next deploy restarts its workers and cron jobs too. Staged changes list them. The app's Variables page names them ("Also used by queue, scheduler").
  • Environment copies, previews and promotions don't copy the app's variables to the worker. It follows the app in every environment.

Shared variables

Shared variables belong to the project instead of one service, with the same targeting. They are not added to every service automatically. A service either references one as ${{shared.KEY}} or switches it on in the Shared variables section on its Variables page, which adds it under its own key. A Compose import creates shared variables for values several services use.

Settings your code reads

When launchroom detects how to build your app, it also reads which settings your code asks for (env('MAIL_HOST'), process.env.STRIPE_SECRET_KEY, os.getenv('SENTRY_DSN'), ENV.fetch('REDIS_URL')) and which of them have a default in your code. Settings → Build sums this up in one card instead of a warning per setting:

  • Required: secrets the app can't start without, such as RAILS_MASTER_KEY. Each has Add as a secret.
  • Common: settings most apps set before going live, such as mail and the app's name. Add the common ones opens one field per setting with a suggested value where one fits most setups. Fields you leave empty are skipped, so your code keeps its default.
  • Optional: everything else, folded. A fresh Laravel app reads around a hundred settings and needs none of them.

If a deploy failed after you changed variables, the Variables tab marks the ones the running version doesn't have yet as Not live yet. They go live with the next deploy that succeeds.

Build or runtime

launchroom decides for each variable whether the build sees it, so changing a runtime value doesn't trigger a rebuild:

  • Build and runtime, automatically, for values frameworks bake into the bundle (NEXT_PUBLIC_*, VITE_*, PUBLIC_*, REACT_APP_*, EXPO_PUBLIC_*, GATSBY_*) and build tooling (SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT, NODE_OPTIONS, NPM_TOKEN, NPM_CONFIG_*, COMPOSER_AUTH, PIP_INDEX_URL, UV_INDEX_URL, BUNDLE_*), and NEXT_SERVER_ACTIONS_ENCRYPTION_KEY.
  • Runtime only for everything else, including NUXT_PUBLIC_* (Nuxt reads it at runtime) and AUTH_SECRET and NEXTAUTH_SECRET. If your build reads one of them, choose Build and runtime for it.

Each row labels its availability: Runtime only, Build only, or Build + runtime. Set this explicitly in the variable editor's Available at field. If your build imports code that needs a secret, choose Build and runtime; its value is still sent as a BuildKit secret. Missing-variable build errors link back to the variable editor with this availability selected.

Changing a build variable rebuilds the service. Changing a runtime variable restarts it. Variables baked into a browser bundle are visible to anyone who loads the page, so they can't be secrets. Build values reach the build as BuildKit secrets, never as image layers. See How builds work.

Variables launchroom sets

The Variables page lists the system variables, read-only. A variable you set with the same key replaces it, and the page says so.

VariableValue
PORTThe port the service listens on
PRIVATE_HOST, PRIVATE_URLThe service's slug and private address
DOMAIN, PUBLIC_URLThe first custom domain, else the generated one
DOMAINS, PUBLIC_URLSEvery domain of the service, comma-separated, the primary one first: custom domains, then generated ones
LAUNCHROOM, LAUNCHROOM_PROJECT_ID, LAUNCHROOM_ENVIRONMENT, LAUNCHROOM_ENVIRONMENT_ID, LAUNCHROOM_ENVIRONMENT_KIND, LAUNCHROOM_SERVICE, LAUNCHROOM_SERVICE_IDWhere the service runs
LAUNCHROOM_DEPLOYMENT_ID, LAUNCHROOM_GIT_COMMIT_SHAThe current deployment and commit (can't be referenced)

Workers and cron jobs get their app's DOMAIN, PUBLIC_URL, DOMAINS and PUBLIC_URLS.

A few more depend on the framework:

  • HOST and HOSTNAME are 0.0.0.0 for JavaScript servers (Node, Nuxt, SvelteKit, Astro, React Router, TanStack Start, Angular SSR, Gatsby). Next.js gets HOSTNAME from its preset. Other services don't get them: if your server reads HOST to choose its address, set HOST=0.0.0.0 yourself.
  • WEB_CONCURRENCY for Python and Ruby web services built with Railpack: two worker processes per CPU, at most one per 256 MB of memory, between 1 and 16. gunicorn, uvicorn and Puma read it.

Variables that follow your domains

Frameworks read their address from their own variables. The preset names them, and launchroom fills them in for each environment and preview from its domains:

FrameworkVariables
LaravelAPP_URL from PUBLIC_URL
SymfonyDEFAULT_URI from PUBLIC_URL; SYMFONY_TRUSTED_PROXIES, TRUSTED_PROXIES
DjangoThe variables your settings read ALLOWED_HOSTS and CSRF_TRUSTED_ORIGINS from, such as DJANGO_ALLOWED_HOSTS
Django, FastAPI, Flask, LitestarFORWARDED_ALLOW_IPS
PhoenixPHX_HOST from DOMAIN
NextAuth 4NEXTAUTH_URL from PUBLIC_URL
RocketROCKET_PORT from PORT

Allowed-hosts lists hold the service's domains, its slug and localhost. Trusted proxies are the addresses launchroom's proxy connects from. Workers and cron jobs get the same values as their app. A service without a domain gets none of the domain-based values. A variable you set with the same key always wins, and Settings → Build lists these under "Set for each environment from its address".

Encryption

Values are encrypted at rest with envelope encryption: each project has its own data key, wrapped by a key-encryption key stored in the install folder (data/keys), apart from the database. Each value is bound to its project, variable and version, so a stored value can't be moved to another row. A deployment's environment is stored encrypted too. Deployment pages show variable names and hashes, never values.

Production secrets must differ from preview (project Settings → General) refuses any secret that applies to production with the same value as one that applies to previews, wherever it is saved.

From the command line

The CLI reads and writes the same variables for the linked service (launchroom link, or --service):

launchroom env ls
launchroom env set LOG_LEVEL=debug
launchroom env set --secret STRIPE_SECRET_KEY=...
launchroom env pull .env
launchroom run -- npm run dev

env pull and run resolve references on the server from the last deployed configuration. Secret values need a token with the secrets:read ability and a role that may reveal them. Each read is audited. --no-secrets leaves them out.

Next steps

On this page