Environment and secrets
Set variables and secrets for an app, what reaches the build, and how the file and the CLI work together.
cluz env set PORT=8080 LOG_LEVEL=info
cluz env set DATABASE_URL --secret < db-url.txt # value from stdin, not shell history
cluz env set STRIPE_KEY --secret # prompts (the prompt echoes)
cluz env set NEXT_PUBLIC_SITE_URL=https://shop.example.com --build
cluz env list
cluz env rm LOG_LEVELSecrets
A secret is encrypted, never shown again, and printed as (secret) by env list. Updating a secret without --secret keeps it secret. A new value is in force from the next deploy.
In the file
In clusterz.yaml, value sets a fixed variable, generate makes a random secret once, from_service gives the address of another service, and required stops a deploy until the variable has a value. Variables in the file lists every field.
At build time
--build makes a variable available at build as well as to the running app: buildpacks read it as an environment variable, and a Dockerfile as a build argument it declares with ARG, so a value such as NEXT_PUBLIC_SITE_URL is built into the app. The build log masks its value when it is four characters or longer.
Updating a variable without --build keeps what it had, and --build=false makes it the running app's alone. env list shows which variables reach the build.
Other environments
-e staging or -e preview sets a variable for another environment. The default is production.