Add PGURI env var for passing connection string to psql in Docker

Поиск
Список
Период
Сортировка
От Michael Leonhard
Тема Add PGURI env var for passing connection string to psql in Docker
Дата
Msg-id CAHnQ7HPieKJEfHfFzf+PavQ_EA9Z3gxQ4RWNSKiOSACjgN+6-A@mail.gmail.com
обсуждение исходный текст
Ответы Re: Add PGURI env var for passing connection string to psql in Docker  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Soumyadeep Chakraborty
Дата:
Сообщение: Re: WIP: expression evaluation improvements
Следующее
От: Andres Freund
Дата:
Сообщение: Re: [HACKERS] Moving relation extension locks out of heavyweightlock manager