connector-x
connector-x copied to clipboard
Add support for pgpass
We follow the spec in https://www.postgresql.org/docs/current/libpq-pgpass.html,
Order of passfile path is:
- passfile path specified in connection string, e.g.
postgresql://localhost:5432?passfile=/home/someuser/secret/.pgpass - default path
~/.pgpassin *nix,%APPDATA%\postgresql\pgpass.confin windows.
- pgpass file needs to have safe permissions
0600or we raise an exception. - pgpass needs to follow the spec format,
host:port:db_name:user_name:password, so*:*:*:*:passwordis valid, justpasswordis not.
pgpassfile has precedence over the given connection string.
Fixes: #567