Klef docs
Commands

Environments

Create, list, rename, delete, and copy environments within a project.

An environment is the unit of encryption. Each one has its own key, so development, staging, and production secrets stay cryptographically separate. All environment commands act on the current project (the one the .klef file points to).

klef env create

Create a new environment.

klef env create staging

Options

FlagDescription
-n, --name <name>Display name (defaults to the slug).
-c, --color <hex>UI color hint, for example #ef4444.
klef env create staging --name "Staging" --color "#ef4444"

klef env list

List the current project's environments.

klef env list

klef env use

Set the default environment for the current directory. This rewrites the defaultEnvironment in .klef, so every command in this directory targets the new environment by default (you can still override per command with -e). Think of it as switching branches.

klef env use staging

It validates that the environment exists in the project, but it does not unlock your key chain, so it never prompts for your password. The .klef file is meant to be committed, so a switch you make here is shared with your team unless you keep it local.

klef env rename

Rename an environment by changing its slug.

klef env rename old-slug new-slug

klef env delete

Permanently delete an environment and all of its secrets.

klef env delete staging

Asks for confirmation. Skip it with -y, --yes.

FlagDescription
-y, --yesSkip the confirmation prompt.

Deleting an environment removes all of its secrets. This cannot be undone.

klef env copy

Copy all secrets from one environment to another. This is a full replace of the destination: the destination's existing secrets are replaced with the source's.

klef env copy development staging
FlagDescription
-y, --yesSkip the confirmation prompt.

On this page