openv
openv copied to clipboard
A tool that uses the credentials stored in 1password as an environment variable.
openv
A tool that uses the credentials stored in 1password as an environment variable.
Requirements
Getting Started
# Sign in to 1password. e.g. `op signin my`.
$ eval $(op signin <sign_in_address>)
# Create vault in 1password.
$ op create vault myenv
# openv can register credentials to 1password vault.
$ openv myenv create SECRET_TOKEN
myenv.SECRET_TOKEN> this-is-token
$ openv myenv create HIDDEN_TOKEN
myenv.HIDDEN_TOKEN > this-is-hidden
# List credentials for the specified vault.
$ openv myenv list
HIDDEN_TOKEN
SECRET_TOKEN
# All credentials in vault can be set as environment variables with the `get` command
$ env $(openv myenv get) sh -c 'env | grep TOKEN'
SECRET_TOKEN=this-is-token
HIDDEN_TOKEN=this-is-hidden
# With the `-n` option, specify the credentials in vault.
# Also by separating item name with a colon, specify environment variable name.
$ env $(openv myenv get -n SECRET_TOKEN:MY_ENV) sh -c 'echo $MY_ENV'
this-is-token
> env $(openv myenv get -n SECRET_TOKEN:MY_ENV -n HIDDEN_TOKEN) sh -c 'echo $MY_ENV $HIDDEN_TOKEN'
this-is-token this-is-hidden
Install
On macOS via Homebrew
$ brew tap mrtc0/openv
$ brew install openv
From binaries
Check out the release page for prebuilt versions of openv
for many architectures.
From source
$ cargo install openv
Completion
If you are using fish, you can use https://github.com/mrtc0/fish-openv-completions .
Development
# Run tests
$ cargo test
# Build
$ cargo build --bins
# Install
$ cargo install --path . --locked