PMV
PMV is a tiny utility for working with the 1password CLI.
Commands
env
Generates a set of environment export variables from a 1password tag.
- Login to 1password, eg
eval $(op signin gitlab)
- Create an item in 1password and configure it with a unique tag. Note that slashes (
/
) in tags will be shown hierarchically in the 1password UI, which can be useful for categorization.
- Each field with a
env:
prefix will be emitted as an export. For example env:GITLAB_TOKEN=xyz
will generate export GITLAB_TOKEN=xyz
.
- Use
eval $(pmv env Tag)
to export the environment variables into the current shell.
Usage:
$ # Before using pmv, log using 1password client
$ eval $(op signin gitlab)
$ # Sample usage of `pmv env`
$ pmv env ProductName/Env:Test
export SECRET=abc
export OTHER_SECRET=xyz
$ # More useful usage, exports variables to shell
$ eval $(pmv env ProductName/Env:Test)
$ # Secrets are now loaded into the environment
json
Generates a secrets blob in JSON
- Login to 1password, eg
eval $(op signin gitlab)
- Create an item in 1password and configure it with a unique tag. Note that slashes (
/
) in tags will be shown hierarchically in the 1password UI, which can be useful for categorization.
- Each field with a
json:
prefix will be emitted as an export. For example json:secret=xyz
will generate {"secret": "xyz"}
.
- Use
pmv env Tag > secrets.json
to write the secrets to a file.
Usage:
# Before using pmv, log using 1password client
eval $(op signin gitlab)
# Sample usage of `pmv json`
pmv json ProductName/Env:Test > secrets.json