Skip to content

Keep .env in your project.Keep secrets out of it.

pw-env resolves empty env keys from 1Password, Bitwarden, or GPG-backed files, then streams the results straight into your shell.

pw-env
Rust CLI1Password, Bitwarden, and GPGAutomatic activation
Why it exists

pw-env keeps the project-facing ergonomics of a normal .env file while moving secret resolution to the edge of your shell session.

What changes in practice

Developers keep checked-in env shape, approvals stay explicit, and secret values stop drifting into repositories and local plaintext copies.

Example

console
eval "$(pw-env export . --shell bash)"
dotenv
DATABASE_URL=
API_KEY=op://Development/my-app/api_key
LOG_LEVEL=debug # pw-env:ignore
bash
DATABASE_URL=sqlite:///example.db
API_KEY=XdASdf923.....
LOG_LEVEL=debug # pw-env:ignore

Fast path

01Shape the project env

Leave secret keys empty or point them at a specific backend reference.

02Pick a default backend

Resolve empty values through 1Password, Bitwarden, or a GPG-backed env file.

03Load on demand or on cd

Export once for a shell session or install a hook that follows your working directory.

Install

console
curl -fsSL https://m42e.de/pw-env/install.sh | bash
powershell
PS> & ([scriptblock]::Create((irm https://m42e.de/pw-env/install.ps1)))
console
curl -fsSL https://m42e.de/pw-env/install.sh | bash -s -- --version v0.2.8
console
cargo build --release
./target/release/pw-env --help

Learn the flow

What a project looks like

text
my-service/
├── .env
├── .pw-env.toml
└── .git/
dotenv
DATABASE_URL=
API_KEY=bw://env-secrets/my-service/api_key
LOG_LEVEL=debug # pw-env:ignore

Use a global config for defaults, and add .pw-env.toml only when a project needs a local override. The local override is discovered by walking upward from the current directory until the repository root.