Skip to main content

Environment variables and secrets

Projects can have up to 100 environment variables. Each is either plain or a secret. Values are encrypted at rest and injected into the app's containers when they start, so a change reaches the app on the next deploy.

Add or change variables​

  1. In the console open the project's Settings, then Environment variables and Add variable.
  2. Enter a name and value. Turn on Secret for API keys, passwords and tokens.
  3. Save. A banner says the changes aren't live yet; select Redeploy to apply.

From the CLI:

tc env ls
tc env set GREETING=hello REGION=emea
tc env set API_KEY=sk-123 --secret --redeploy # write-only, and apply now
tc env unset REGION --redeploy
tc redeploy # apply pending changes later

Over MCP: list_env, and set_env with vars, unset and redeploy: true.

Secrets are write-only​

Once saved, a secret's value is never returned by the console, the API, the CLI or MCP, not even its last characters; it shows as ••••••••. A secret can't be turned back into a plain variable by an update. The audit log records variable names only, never values.

Your app can still show which settings it has without echoing secrets: the platform adds TC_ENV_PUBLIC, a comma-separated list of the non-secret variable names.

Names​

RuleDetail
CharactersLetters, digits and _, not starting with a digit; at most 128 characters
Reserved prefixAnything starting with TC_ belongs to the platform
Reserved namesDATABASE_URL, PORT, HOSTNAME, PATH, HOME, NODE_OPTIONS
Value sizeAt most 32 KB; no NUL bytes
CountAt most 100 per project

Applying changes: redeploy​

Variables are read when a container starts. Redeploy creates a new deployment from the current production image with the current variables, health-checks it and promotes it. It doesn't rebuild, rescan or run migrations, so it's fast. A normal deploy also picks up the current variables.

Cron and worker services get the same variables on their next run or start.

warning

Static sites have no server, so variables don't reach them. The Settings page says so for static projects. Use variables from an API or worker service instead.

Who can change variables​

The owner, people with the developer app role, Org Admins, and Delegated Admins whose scope covers the owner. Auditors see variable names without values.

Availability

On the local stack values are encrypted with AES-256-GCM, each bound to its project and name so a copied ciphertext won't decrypt elsewhere. On Azure, values move to Azure Key Vault; that driver is coming soon.

Was this page helpful?