Configuration
Config Command
Section titled “Config Command”bwenv v2 has a built-in configuration system managed through an interactive TUI:
bwenv configThis opens a settings editor where you can toggle preferences with arrow keys.
Settings
Section titled “Settings”| Setting | Default | Description |
|---|---|---|
| Show Emoji | ON | Display emoji icons in bwenv output. Turn off for cleaner text-only output. |
| Show Direnv Output | OFF | Show or hide direnv’s own loading/unloading messages. When OFF, bwenv adds DIRENV_LOG_FORMAT="" to your shell RC file. |
| Show Export Summary | ON | Show the boxed summary of exported variables when secrets are loaded via direnv. |
| Auto Sync | ON | Automatically sync the vault before fetching secrets (Bitwarden only — runs bw sync). |
Config File
Section titled “Config File”Settings are persisted to:
~/.config/bwenv/config.jsonExample contents:
{ "show_emoji": true, "show_direnv_output": false, "show_export_summary": true, "auto_sync": true}You can edit this file manually if needed, but using bwenv config is recommended.
Project Files
Section titled “Project Files”.envrc
Section titled “.envrc”Generated by bwenv init in each project directory. Contains a single eval call that fetches secrets from your vault at load time:
# bwenv: provider=bitwarden folder="My Secrets"# Run bwenv login to re-authenticate if session expireseval "$(BW_SESSION='...' bwenv export --provider bitwarden --folder 'My Secrets')"- No secrets are stored on disk (only session tokens, which expire)
- Secrets are fetched live from your vault each time direnv loads
- Add
.envrcto your.gitignore
Config directory
Section titled “Config directory”~/.config/bwenv/└── config.json # User preferencesEnvironment Variables
Section titled “Environment Variables”Managed by bwenv
Section titled “Managed by bwenv”| Variable | Description |
|---|---|
BW_SESSION | Bitwarden session token. Set in .envrc by bwenv init/bwenv login. Expires after vault timeout. |
DIRENV_LOG_FORMAT | Set to "" in your shell RC when “Show Direnv Output” is OFF, to suppress direnv messages. |
Used by bwenv (CI/CD)
Section titled “Used by bwenv (CI/CD)”| Variable | Description |
|---|---|
BW_SESSION | Pre-set a Bitwarden session for non-interactive export |
OP_SERVICE_ACCOUNT_TOKEN | 1Password service account token for non-interactive export |
BW_CLIENTID / BW_CLIENTSECRET | Bitwarden API credentials for CI authentication |
Provider Integration
Section titled “Provider Integration”Bitwarden
Section titled “Bitwarden”- CLI:
bw— Install - Auth: Master password (prompted in TUI) or pre-set
BW_SESSION - Secrets: Custom fields on items within folders. Field name = env var name, field value = env var value.
- Sync:
bw syncruns automatically before fetching if Auto Sync is ON - Lock:
bwenv logoutrunsbw lock
1Password
Section titled “1Password”- CLI:
op— Install - Auth: System biometrics (op v2) or manual sign-in
- Secrets: Item fields within vaults. Field label = env var name, field value = env var value. Notes and OTP fields are skipped.
- Lock:
bwenv logoutrunsop signout
Adding a Provider
Section titled “Adding a Provider”bwenv’s provider system is extensible. To add a new provider:
- Create a file in
internal/provider/(e.g.doppler.go) - Implement the
Providerinterface (including theLock()method) - Call
Register(&YourProvider{})in aninit()function - The provider automatically appears in the TUI picker and CLI flags
Folder Structure Recommendations
Section titled “Folder Structure Recommendations”Organize secrets in your password manager by project and environment:
Vault / Folders├── ProjectA - Development├── ProjectA - Staging├── ProjectA - Production├── ProjectB - Development└── Shared ToolsUse consistent field names across environments so you can switch between dev/staging/prod by just pointing bwenv at a different folder.
Security Notes
Section titled “Security Notes”- No secrets on disk —
.envrccontains only anevalcommand with a session token, not actual secrets - Session tokens expire — Bitwarden sessions expire based on vault timeout settings
- Lock when done —
bwenv logoutlocks vaults and terminates sessions .envrcin.gitignore— Never commit environment files to version control- Direnv approval —
.envrcmust be explicitly approved viadirenv allow(orbwenv allow)
Troubleshooting
Section titled “Troubleshooting”Session expired
Section titled “Session expired”bwenv login # Re-authenticate and update .envrcNo secrets found / 0 variables loaded
Section titled “No secrets found / 0 variables loaded”- Bitwarden: Ensure items have custom fields (not just username/password)
- 1Password: Ensure items have fields with labels and values
direnv messages appearing
Section titled “direnv messages appearing”bwenv config # Toggle "Show Direnv Output" to OFFOr restart your shell after bwenv has added the DIRENV_LOG_FORMAT line.
Full diagnostic
Section titled “Full diagnostic”bwenv status # Shows everything at a glance