Password Options
Specifying a Password
Database passwords are never stored in a configuration file. The tool obtains passwords in this order of priority:
- pgEdge Document Loader first checks the
PGPASSWORDenvironment variable:
export PGPASSWORD=mypassword
pgedge-docloader --config config.yml
- It then checks the
~/.pgpass filefor an entry:
localhost:5432:mydb:myuser:mypassword
Your /.pgpass file must have proper permissions:
chmod 600 ~/.pgpass
Note
If a password is required but not provided through PGPASSWORD or .pgpass, PostgreSQL will return an authentication error with a clear message.
-
If Document Loader doesn't find a password in the two previous locations, it then attempts passwordless authentication. This allows PostgreSQL to use configured authentication methods such as:
-
Trust authentication
- Peer authentication
- Certificate-based authentication (using
db-sslcertanddb-sslkey)
If no password is found and an alternative authentication method is not configured, the tool will prompt:
pgedge-docloader --config config.yml
Enter database password: ****
Using an Environment Variable to Specify a Password
export PGPASSWORD=mypassword
pgedge-docloader --config config.yml
Using the .pgpass File to Store a Password
Create ~/.pgpass:
localhost:5432:mydb:myuser:mypassword
Set permissions:
chmod 600 ~/.pgpass
Using an SSL/TLS Connection
Include the following options to connect using SSL/TLS with client certificates:
pgedge-docloader \
--source ./docs \
--db-host secure.example.com \
--db-name mydb \
--db-user myuser \
--db-table documents \
--db-sslmode verify-full \
--db-sslcert ./certs/client.pem \
--db-sslkey ./certs/client-key.pem \
--db-sslrootcert ./certs/ca.pem \
--col-doc-content content \
--col-file-name filename
The supported SSL modes are:
disable- No SSLallow- Try SSL, fall back to non-SSLprefer- Try SSL, fall back to non-SSL (default)require- Require SSL, but don't verify certificatesverify-ca- Require SSL and verify CA certificateverify-full- Require SSL and verify certificate and hostname