Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for url-like connection strings #151

Closed
piotrkilczuk opened this issue Nov 25, 2020 · 1 comment
Closed

Add support for url-like connection strings #151

piotrkilczuk opened this issue Nov 25, 2020 · 1 comment

Comments

@piotrkilczuk
Copy link

psql allows you to connect with the following syntax:

psql postgresql://user:pass@host/db

It would be helpful if pg_activity provided the same ability.

Especially useful if you store your connection strings in some kind of environment variables.

@piotrkilczuk piotrkilczuk changed the title Add support for url-line connection strings Add support for url-like connection strings Nov 26, 2020
blogh added a commit to blogh/pg_activity that referenced this issue Nov 27, 2020
Add connection strings to address dalibo#151 & dalibo#147

The idea is to mimic psql behavior of allowing a connection string to be
specified as argument of the script. In that case the information provided
overrides the host, port, user and dbname options.

Two syntax are possible (depending in the version of libpq).
(https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING)

pg_activity "host=/tmp port=5432 user=toto dbname=pgbench"
pg_activity "postgresql://toto@localhost:5432/bench"
@dlax
Copy link
Member

dlax commented Jan 18, 2021

This got fixed by allowing libpq's connection string to be passed as an argument by 73a71c5 and is available in pg_activity 2.0.0.

@dlax dlax closed this as completed Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants