New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pgai

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pgai

  • 1.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Pgai

Simple CLI wrapper around Postgres.ai CLI to drop directly into a PSQL session.

Installation

Install the gem by executing:

gem install pgai

Configuration

For an overview of available commands, execute:

pgai -h

Before usage pgai config must be executed and at least an environment must be configured with pgai env add.

An access token will be required and it can be obtained from: https://console.postgres.ai/gitlab/tokens

Example:

pgai config --prefix=<gitlab handle>

To configure environments:

pgai env add --alias ci --id ci.lab.internal --port 2345 -n gitlabhq_dblab

The environment id and port can be found by clicking on the Connect button on a database instance page.

The the id attributes must be configured for SSH port forwarding via the ~/.ssh/config file. Example:

Host <bastion>
  User <username>
  IdentityFile ~/.ssh/id_ed25519


Host *.lab.internal
  User <username>
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/id_ed25519
  ProxyCommand ssh <bastion> -W %h:%p

Usage

pgai connect <env alias>

Multiple connect commands for an environment will connect to the same clone, it won't start a new one.

pgai use --only <env alias> -- command can be used to run commands with access to a clone. Example for connecting a Rails console to the CI database:

pgai use -o ci -v -- bin/rails c -e test

Features

  • multiple psql sessions to the same clone
  • multiple environments support
  • automatic port forward management
  • prevents system sleep while psql sessions are active via caffeinate

Upgrading from version 0

  • Update and test the ssh config file
  • ~/.dblab/ and its contents can be removed
  • ~/.config/pgai/config.pstore should be removed and recreated with pgai config
  • The environment ID serves as the proxy host and the database name can be configured per environment.
  • Environments can share the same remote port value.

Contributing

Bug reports and pull requests are welcome on GitLab at https://gitlab.com/mbobin/pgai.

FAQs

Package last updated on 05 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc