Variables
Variables are how you pass configuration and secrets into a service. They are available during the build and in the running container.
Changing a variable stages a config update. Deploy (or the automatic rolling deploy when you save from the service sheet) applies it.
Service variables
Section titled “Service variables”Open a service on the canvas → Variables. Add a key and value, or paste a .env file.
Use plaintext for flags and URLs. Mark secrets (API keys, passwords) so they are encrypted at rest and redacted in the UI and build logs.
NODE_ENV=productionLOG_LEVEL=infoDATABASE_URL=postgresql://…In your app, read them as environment variables (process.env.DATABASE_URL, os.environ["DATABASE_URL"], and so on).
Variables from a database
Section titled “Variables from a database”When you add a database on the same canvas, do not paste the URL by hand. In stackblaze.yaml use fromDatabase:
envVars: - key: DATABASE_URL fromDatabase: name: postgres property: connectionString - key: REDIS_URL fromDatabase: name: cache property: connectionStringThe platform injects the live connection string for that environment. See Config as Code.
Shared groups
Section titled “Shared groups”In config as code, fromGroup attaches a named group of variables to a service so you are not copying the same keys onto every tile. Prefer groups or fromDatabase over duplicating secrets.
Per environment
Section titled “Per environment”Variables are scoped to the environment you are viewing (production, a custom environment, or a PR preview). Production values are not automatically copied into previews — preview databases get their own connection strings.
Variables live on the service spec. Create a kbr_pat_ token, then read or update the service:
export STACKBLAZE_TOKEN=kbr_pat_…
curl -sS https://api.stackblaze.cloud/api/apps/acme-app/production/api \ -H "Authorization: Bearer $STACKBLAZE_TOKEN"From the CLI: stackblaze variables list / set / delete. See the CLI and the API reference.