New parser: PostgreSQL Password File
See original GitHub issueBeing able to read the PostgreSQL Password File as JSON would be handy and it is a very simple format:
The file .pgpass in a user’s home directory… should contain lines of the following format:
hostname:port:database:username:password
Each of the first four fields can be a literal value, or *, which matches anything. The password field from the first line that matches the current connection parameters will be used. (Therefore, put more-specific entries first when you are using wildcards.) If an entry needs to contain : or , escape this character with .
So cat /var/lib/postgresql/.pgpass | jc -yp --pgpass
could perhaps return something like:
---
- hostname: localhost
port: 5432
database: foo
username: bar
password: baz
Issue Analytics
- State:
- Created 10 months ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Documentation: 15: 34.16. The Password File - PostgreSQL
The file .pgpass in a user's home directory can contain passwords to be used if the connection requires a password (and no password...
Read more >pgpasslib — pgpasslib 1.1.0 documentation
pgpasslib is a library for retrieving passwords from a PostgreSQL password file, either from a location specified in the PGPASSFILE environment variable or ......
Read more >gsiems/orapass: An Oracle password file parser ... - GitHub
An Oracle password file parsing library and utility based on the .pgpass file available to PostgreSQL users, orapass searches a similarly formatted file...
Read more >How do I specify a password to 'psql' non-interactively?
pgpass file that your bash script has access to. Or don't use passwords at all--you could set up another form of authentication, such...
Read more >Password file paths as libpq connection parameter
Postgres 10 highlight - Password file paths as libpq connection ... now it can also be selected via a new connection parameter "passfile", ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @chriscroome - I have a working version in
dev
now: https://github.com/kellyjonbrazil/jc/blob/dev/jc/parsers/pgpass.pyIt can handle commented lines and also escaped
\
and:
characters. Should theport
field be an integer? (Actually, probably not since the field can be filled with an*
wildcard)Looks good - I’ll start working on some new parsers for the next release soon.