Home

Awesome

PyPI version 1password-secrets

1password-secrets

PyPI version 1password-secrets CI/CD

1password-secrets is a CLI utility to sync 1Password secrets (env files). It enables:

Motivation: Using 1password for this avoids the need for another external secret management tool. And keeps the access control in a centralised place that we already use.

Getting started

Requirements

Installation

In most systems (Mac and Linux) when pip3 (Python's 3 PIP) is in path and you want to install it at the user level:

pip3 install -U 1password-secrets

Otherwise you may need to install it with invoking your preferred Python version: python3 -m pip install -U 1password-secrets.

Or, even more specific python3.12 -m pip install -U 1password-secrets

Also, if your "environment is externally managed" you can bypass it with: python3 -m pip install -U --break-system-packages 1password-secrets

If you use tools like pipx or manage your environment differently adapt the installation instructions.

Usage

Local

1password-secrets will allow you to create, pull and push secrets to a 1password secure note with repo:<owner>/<repo> or local:<dir-basename> in its name. repo is used when within a valid git repository with remote "origin" set.

The remote name can be changed with the --remote switch if you use a different remote (e.g. upstream)

By default it syncs to ./.env file, this can overridden with a file_name field in 1password containing the desired relative file path.

By default it searches items across 1password vaults. Restrict the search to a single vault with the --vault switch.

Fly

Make sure you have a Secure Note in 1Password with fly:<fly-app-name> in the title. fly-app-name is the name of your fly application.

As with Local secrets above, you can specify a single 1Password vault by name or id with the --vault option.

Development

Then you can install (link) the repo globally with make local-install.

Before pushing changes ensure your code is properly formatted with make lint. Auto format the code with make format