Vault commands
zero vault … manages projects, environments and secrets. Install the CLI and
set up your key first: see Zero CLI.
Projects and environments
Section titled “Projects and environments”Projects start with development and production environments.
zero vault projects create demozero vault projects list
zero vault env list -p demozero vault env create staging -p demoManage secrets
Section titled “Manage secrets”zero vault secrets set API_TOKEN=abc123 -p demo -e developmentzero vault secrets list -p demo -e development # values shown maskedzero vault secrets get API_TOKEN -p demo -e development # prints the valuezero vault secrets set is create-or-update; run it again with the same key to
change the value. Set several at once by passing more KEY=VALUE pairs. Delete a
secret with:
zero vault secrets delete API_TOKEN -p demo -e developmentRun a command with the secrets
Section titled “Run a command with the secrets”zero vault run starts a command with the environment’s secrets and writes no
file to disk. Use it instead of downloading a file.
zero vault run -p demo -e production -- node server.jszero vault run -p demo -e development --mount .dev.vars -- wrangler dev--mount serves the secrets through a named pipe for tools that read a dotenv
file. See Loading secrets.
Download secrets
Section titled “Download secrets”zero vault secrets download writes an environment’s secrets in the format you
ask for (env, json, yaml, or shell), to stdout or a file with -o.
zero vault secrets download -p demo -e development -f envAPI_TOKEN=abc123DB_URL=postgres://localhost-f shell emits export KEY="VALUE" lines for sourcing into a shell, -f json a
flat { "KEY": "VALUE" } object, and -f yaml a KEY: "VALUE" list. See
Loading secrets for pulling an environment into a
process or CI job.
Back up the whole vault
Section titled “Back up the whole vault”zero vault export dumps every project and secret across your organization as
plaintext JSON, and zero vault import <file> restores it. Because the file is
plaintext, delete it as soon as you are done.
zero vault export -o vault-backup.json