Set variables
UsePATCH to add or update values while keeping existing variables:
Update service variables
PUT on the same route replaces all variables for the service. Keep secrets server-side and out of committed .locusbuild files.
Service-to-service references
Locus injects sibling service URLs automatically. A service namedapi gives other services these variables:
Names are uppercased, with non-alphanumeric characters replaced by underscores.
Template syntax
Use templates to connect a setting to a service or addon. For example, setDATABASE_URL to ${{db.DATABASE_URL}} to connect to a Postgres addon named db.
Addon templates also expose
HOST and PORT; Postgres adds USERNAME and DATABASE. Wait until the addon is available before deploying a service that references it.
Only services with explicit addon references receive those connection variables.
Full-stack .locusbuild example
This connects an API to Postgres and Redis, and a frontend to the API:.locusbuild
Variable scopes
When the same name exists in multiple scopes, service variables take priority over environment variables, which take priority over addon variables.Get resolved variables
Preview values before deploying:Preview resolved variables