Docs
The project file

Variables in the file

The env fields of a service in clusterz.yaml, where a value comes from, and when a deploy is refused.

Each entry of a service's env is one environment variable. Only key is required.

FieldWhat it does
services[].envThe service's variables.
services[].env[].keyThe variable's name: letters, digits and underscores, not starting with a digit. Each name appears once.
services[].env[].valueA fixed value. It is set again on every deploy, so the file owns it. A secret does not take a value in the file: set it with cluz env set.
services[].env[].generateA random value of 8 to 128 characters, made once and kept. It is a secret.
services[].env[].from_serviceThe address of another service of the same file: the app's address for the web, a public api's own address once it resolves, else the service's name and port on the app's network, like http://api:8080. It cannot name the service itself, nor a worker, which listens on no port.
services[].env[].from_databaseThe connection string of a database of the same file, under this variable's name, like REPORTS_URL, for a service that is not in that database's for.
services[].env[].requiredA deploy is refused until the variable has a value, which you give in the form or with cluz up --set KEY=VALUE for the web (--set api.KEY=VALUE for another service, and for every service of an app with no web).
services[].env[].secretThe value is kept encrypted and never shown again.
services[].env[].at_buildThe variable is available to the build as well as to the running service.

One source for a value

A variable sets at most one of value, generate, from_service and from_database. With none of them, the variable is the team's to set. A variable that the file gives a value needs no check, so required is refused beside any of them.

Variables a browser reads

Next.js, Vite and other frameworks build variables whose names start with NEXT_PUBLIC_, VITE_, REACT_APP_, NUXT_PUBLIC_, PUBLIC_, EXPO_PUBLIC_ or GATSBY_ into the code a browser downloads. A browser cannot reach a private api, so such a variable cannot take from_service of one. Give the api public: true, or call it from the web's own server.

Environment and secrets explains how the values reach the app.