Crate vpg

Crate vpg 

Source
Expand description

Update Postgres credentials from Vault, rewrite pgpass & nvim-dbee, optionally launch pgcli.

§Arguments

  • alias Optional database alias (interactive selector if missing).

§Usage

vpg # pick alias interactively -> update credentials -> optional connect
vpg reporting # directly update 'reporting' alias then prompt to connect

§Flow

  1. Read ~/.pgpass & parse entries.
  2. Resolve alias (arg or picker).
  3. Vault login (if needed) + read secret.
  4. Update pgpass & nvim dbee conns file.
  5. Prompt to start pgcli.

§Errors

  • External command (pgcli, vault) fails or exits non-zero.
  • File read / write operations fail.
  • JSON serialization or deserialization fails.
  • Required environment variable missing or invalid Unicode.
  • User selection or prompt interaction fails.

Modules§

nvim_dbee 🔒
pgpass 🔒
vault 🔒

Functions§

exec_vault_read_cmd 🔒
Executes the vault CLI to read a secret as JSON and deserialize it.
main 🔒
Update Postgres credentials from Vault, rewrite pgpass & nvim-dbee, optionally launch pgcli.