Skip to content
Venky edited this page Jun 5, 2023 · 3 revisions

If you want to use the 1Password password manager with direnv to populate secrets from 1Password into your environment, you can use direnv-op.

Dependencies

Installation

git clone https://github.com/venkytv/direnv-op.git
cd direnv-op
make install

Usage

For any directory where you need 1Password secrets to be injected using direnv, add the following to your .envrc file:

use oprc

Create a .oprc file in the same directory with the list of 1Password items you need injected:

cat >.oprc <<EOT
export A_SECRET="op://Vault/Item/credential"
export ANOTHER_SECRET="op://Vault/Another Item/credential"
EOT

You can use op item get "Item Name" --format json to get the reference for a secret.