mirror of
https://github.com/dbcli/pgcli.git
synced 2024-10-06 18:27:29 +03:00
Added support for PGPASSWORD environment variable. Connect #220.
This commit is contained in:
parent
f7cfbaab16
commit
f12f2937ed
@ -142,6 +142,11 @@ class PGCli(object):
|
||||
if not database:
|
||||
database = user
|
||||
|
||||
# If password prompt is not forced but no password is provided, try
|
||||
# getting it from environment variable.
|
||||
if not self.force_passwd_prompt and not passwd:
|
||||
passwd = os.environ.get('PGPASSWORD', '')
|
||||
|
||||
# Prompt for a password immediately if requested via the -W flag. This
|
||||
# avoids wasting time trying to connect to the database and catching a
|
||||
# no-password exception.
|
||||
|
Loading…
Reference in New Issue
Block a user