Skip to main content
Variables are set per-service and injected as environment variables into the container at deploy time. Locus also auto-injects service-to-service URLs and addon connection strings — no manual wiring needed.

Set variables

Replace all (PUT)

Replaces all existing variables on the service.

Merge (PATCH)

Adds or updates variables while keeping existing ones.
After setting variables, trigger a new deployment for them to take effect.

Get resolved variables

Returns all variables with addon connection strings and auto-injected sibling service URLs resolved.

Variable scopes

Variables are resolved in this order — higher priority wins when the same key exists at multiple scopes:

Service-to-service references

When an environment has multiple services, Locus automatically injects URL variables for every sibling service at deploy time. No manual wiring or linking is needed.

Auto-injected variables

For each sibling service in the same environment: The service name is uppercased with non-alphanumeric characters replaced by underscores. For example, a service named api produces API_URL and API_INTERNAL_URL.

Template syntax

You can reference sibling services and addons in variable values using template syntax. Templates are resolved at deployment time.

Service templates

Addon templates

Addon templates (e.g., ${{db.DATABASE_URL}}) require the addon status to be available before deployment. Use GET /v1/variables/service/:id/resolved to preview resolved values.

Full-stack .locusbuild example

A .locusbuild file using all template types together:
Addon variables require explicit references. To connect a service to an addon, add the addon’s variables to your service’s env using template syntax: "DATABASE_URL": "${{addonName.DATABASE_URL}}". Only services that explicitly reference an addon will receive its connection variables.