Secrets
Workers often need credentials, for example a token for an external API. Managed deployments read them from the workspace Secrets Manager: you bind a workspace secret to an environment variable, and the worker reads the value from its environment at boot. Only secrets from the deployment's workspace can be bound.
Bind a workspace secret to your deployment:
1.
Create your secrets at Studio › Secrets.2.
Reference them when creating your managed deployment on the Studio › Deployments page: each binding maps one environment variable to one workspace secret. Leave the variable name empty to reuse the secret's name.3.
Update the referenced secrets of a running deployment on its settings tab: Studio › Settings.
Changing a secret's value does not restart the worker. The worker keeps the value it read at boot. To pick up a new value, restart the deployment.
Available at build and at runtime
A binding reaches the worker twice:
- At runtime, as an environment variable, read when the worker boots.
- At build time, as a Docker build secret with the same name. Mount it in a RUN step, for example to install packages from a private registry:
RUN --mount=type=secret,id=UV_INDEX_USERNAME,env=UV_INDEX_USERNAME \
--mount=type=secret,id=UV_INDEX_PASSWORD,env=UV_INDEX_PASSWORD \
uv sync --frozen --no-dev
The secret is available to that RUN step only and never persists in the image's history or layers. For compatibility, the value is also passed as a build arg with the same name, so existing Dockerfiles keep building. But a matching ARG writes the value into the image's history, and the build log warns about it: drop the ARG and read the secret with the mount instead.