From: | Michael Leonhard <michael(at)leonhardllc(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Add PGURI env var for passing connection string to psql in Docker |
Date: | 2020-02-20 02:25:10 |
Message-ID: | CAHnQ7HPieKJEfHfFzf+PavQ_EA9Z3gxQ4RWNSKiOSACjgN+6-A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi PostgreSQL Hackers,
Please forgive me if this is not the preferred place to suggest a new
feature. I found that a lot of items in the psql TODO list [1] were
posted to this email list.
I need to pass a connection string to psql inside Docker [2]. I can
pass it as a process argument, but this exposes the password to other
processes on my machine:
$ docker run --rm -i -t postgres:11 psql "$(cat db_uri)"
The alternative is to parse the URI, remove the password, and provide
the password via environment variable. It's ugly:
$ PGPASSWORD=$(cat db_uri |grep -oE ':[a-zA-Z0-9]*@' |tr -d :@ ) \
docker run --rm -i -t postgres:11 \
psql "$(cat db_uri |sed 's/:[:alnum:]*@/@/')"
I would prefer to do this:
$ PGURI="$(cat db_uri)" docker run --rm -i -t postgres:11 -e PGURI psql
How about adding PGURI to the list of supported environment variables [3]?
Sincerely,
Michael
[1] https://wiki.postgresql.org/wiki/Todo#psql
[2] https://hub.docker.com/_/postgres
[3] https://www.postgresql.org/docs/devel/app-psql.html#APP-PSQL-ENVIRONMENT
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2020-02-20 02:36:12 | Re: [HACKERS] Moving relation extension locks out of heavyweight lock manager |
Previous Message | Soumyadeep Chakraborty | 2020-02-20 01:17:57 | Re: WIP: expression evaluation improvements |