summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/client.py
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2021-02-24 17:16:45 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-03-01 09:33:49 +0100
commit8380fe08a025bd41b242c545f7c1b4f333274cbc (patch)
tree8ee70bbde10fffce3ab8bc39b94d3cfbd33d064b /django/db/backends/postgresql/client.py
parent9f125fce7971714333d23c7f554411342466721c (diff)
downloaddjango-8380fe08a025bd41b242c545f7c1b4f333274cbc.tar.gz
Fixed #32456 -- Added dbshell support for specifying a password file on PostgreSQL.
Diffstat (limited to 'django/db/backends/postgresql/client.py')
-rw-r--r--django/db/backends/postgresql/client.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/db/backends/postgresql/client.py b/django/db/backends/postgresql/client.py
index 873af8cc14..3effab65a8 100644
--- a/django/db/backends/postgresql/client.py
+++ b/django/db/backends/postgresql/client.py
@@ -16,6 +16,7 @@ class DatabaseClient(BaseDatabaseClient):
dbname = settings_dict.get('NAME')
user = settings_dict.get('USER')
passwd = settings_dict.get('PASSWORD')
+ passfile = options.get('passfile')
service = options.get('service')
sslmode = options.get('sslmode')
sslrootcert = options.get('sslrootcert')
@@ -48,6 +49,8 @@ class DatabaseClient(BaseDatabaseClient):
env['PGSSLCERT'] = str(sslcert)
if sslkey:
env['PGSSLKEY'] = str(sslkey)
+ if passfile:
+ env['PGPASSFILE'] = str(passfile)
return args, env
def runshell(self, parameters):