Running commands
Launch a process with the current environment's secrets injected as environment variables.
klef run
Run a command with the current environment's secrets injected as environment variables. The secrets exist only in the child process's environment. They are never written to disk.
klef run -- npm run devUse -- to separate Klef's own flags from the command you want to run.
Everything after the command name is forwarded to the child process untouched,
so flags like node --version are passed through rather than consumed by Klef.
Options
| Flag | Description |
|---|---|
-e, --env <name> | Override the environment from .klef. |
--clean | Drop parent env vars except PATH, HOME, and locale. Secrets only. |
--quiet | Suppress override warnings and the "Running" banner. |
Examples
Run your dev server with development secrets:
klef run -- npm run devRun against production secrets:
klef run --env production -- node server.jsRun with only your secrets in the environment, dropping inherited variables:
klef run --clean -- ./migrate.shWhy klef run over a .env file
klef run keeps secrets out of files entirely. Nothing is written to disk, so
there is no .env.local to accidentally commit or leave behind.