1Password / shell-plugins

Seamless authentication for every tool in your terminal.
https://developer.1password.com/docs/cli/shell-plugins/
MIT License
519 stars 170 forks source link

Add sqitch plugin #420

Open colophonemes opened 8 months ago

colophonemes commented 8 months ago

Overview

Adds a new sqitch plugin, for the Sqitch database change management tool, to authenticate a target database with a password.

_Note that this just targets adding a username/password to the environment, and other connection details are left to the sqitch.conf file, or to CLI flags. This is because Sqitch supports multiple database engines, and the only cross-engine authentication details that you can provide are the $SQUITCH_PASSWORD and $SQITCH_USERNAME vars. See the sqitch-authentication docs for more detail._

Type of change

- [x] Created a new plugin - [ ] Improved an existing plugin - [ ] Fixed a bug in an existing plugin - [ ] Improved contributor utilities or experience ## How To Test

Install Sqitch using appropriate instructions for your platform: https://sqitch.org/download/

Set up (or just have access to) a Postgres database. The database should have a user that requires a password to login (i.e. not locally authenticated).

You could also do this for any of the other DB types supported by Sqitch, but the below instructions assume you're using Postgres.

Create a new working directory and initialise Sqitch:

mkdir sqitch && cd sqitch
sqitch init my_project --engine pg

Your ./sqitch directory should look as follows:

.
├── deploy/
├── revert/
├── verify/
├── sqitch.conf
└── sqitch.plan

Edit sqitch.conf as follows (substituting <username>, <hostname> and <database> for values from your Postgres database connection):

[core]
    engine = pg
[engine "pg"]
    target = test
[target "test"]
    uri = db:pg://<username>@<hostname>/<database>

Run sqitch status. You should be prompted to find the database password in 1Password. After authentication, you should see the following output:

# On database test
No changes deployed

Changelog

Authenticate a database target in the Sqitch database change management tool, using Touch ID and other unlock options with 1Password Shell Plugins.