jazzband / dj-database-url

Use Database URLs in your Django Application.
https://pypi.org/project/dj-database-url/
BSD 3-Clause "New" or "Revised" License
1.49k stars 205 forks source link

Reading .pgpass for a Postgresql connection #140

Closed krzysztofjeziorny closed 2 years ago

krzysztofjeziorny commented 4 years ago

Is there a way to read the .pgpass file for the database connection?

https://www.postgresql.org/docs/12/libpq-pgpass.html

krzysztofjeziorny commented 4 years ago

(Closed accidentally.)

dcwatson commented 2 years ago

I'm not sure if you mean just for looking up passwords, or for reading a full DATABASES config out of, but either way I think this is probably out of scope for this project. There are some Python packages to read/parse .pgpass files, but the tricky thing is that .pgpass files allow for wildcards and multiple entries. We will however support overriding configuration options to make this easier in the (hopefully) near future, i.e. parse("postgresql://user@host/db", PASSWORD=readpgpass()).