env("NAME"). You declare the names in code. The values stay out of git.
Declare the names
.registerWorkspace(wsConfig). Leave out name: the config inherits
the one workspace("…") gives, and naming it here renames the workspace.
Declare every name your stack reads. A name that does not exist reads as null rather than
failing, and the export warns about any env() outside the declared set.
Keep the values in xano/.env
deploy, export and preflight read xano/.env with no flag. On a fresh clone, copy
xano/.env.example to xano/.env and fill it in, or fetch the values from a running backend:
env pull overwrites xano/.env, so it confirms first and names the source.
A deploy refuses a missing value
A deploy that replaces a backend (the default for an ephemeral) replaces its env set with what you send. A declared name that no file and no flag supplies would clear the live value, so the deploy refuses and names the variable. To clear one on purpose:xano/.env, pass a file or one value:
Change a value on a running backend
env set creates or replaces one variable, and env unset removes one. Nothing is deployed and
every other variable stays as it is:
--to, both write to the ephemeral or Xano Engine this project last deployed to, never
to your workspace or a tenant. A write to the workspace or a tenant asks first; --yes skips
the question and is required when the value is piped in. Pipe secrets on stdin to keep them out
of shell history.
Neither command touches xano/.env. Update it too if the next deploy should send the new value.
Rotate a secret with env set, not a deploy
How a backend’s env set changes depends on how code reaches it:
So a release never overwrites production’s values, and promoting it again does not rotate
anything. To change a value on the workspace or a tenant, set it there:
promote and tenant deploy do not create a newly
declared name on the target. Both commands list every name the release reads that the target
lacks, with the env set command that sets it, before they ask to confirm.
Documentation tokens
The token that gates a hosted API documentation site is a secret too, but it is not an env var. Declare only the gate in code:xano/.secrets.json, gitignored, beside xano/.env. xanosdk pull writes
it for a gate that already has one. For a gate you just declared, mint one:
--secrets-file <path>.
deploy --static-env KEY=VALUE is a different thing: it bakes public config into the HTML
a browser downloads. Never put a secret there.Next
- Every flag, the
--bundlecaveat, and the CLI’s own environment variables: environment variables reference. - How env moves between environments when you ship: Promote and go live.