Skip to content
Permalink
Browse files

[dbmanager] PG ignore env if service file is used

Cherry-picked from master

Fixes #14436

Funded by Boundless
  • Loading branch information
Alessandro Pasotti
Alessandro Pasotti committed Apr 12, 2016
1 parent 35c01f8 commit 0bde3574ebedc186546c6336530a5c278e32c824
Showing with 7 additions and 3 deletions.
  1. +7 −3 python/plugins/db_manager/db_plugins/postgis/connector.py
@@ -48,11 +48,15 @@ def __init__(self, uri):
self.host = uri.host() or os.environ.get('PGHOST')
self.port = uri.port() or os.environ.get('PGPORT')

username = uri.username() or os.environ.get('PGUSER') or os.environ.get('USER')
username = uri.username() or os.environ.get('PGUSER')
password = uri.password() or os.environ.get('PGPASSWORD')

self.dbname = uri.database() or os.environ.get('PGDATABASE') or username
uri.setDatabase(self.dbname)
# Do not get db and user names from the env if service is used
if uri.service() is None:
if username is None:
username = os.environ.get('USER')
self.dbname = uri.database() or os.environ.get('PGDATABASE') or username
uri.setDatabase(self.dbname)

expandedConnInfo = self._connectionInfo()
try:

0 comments on commit 0bde357

Please sign in to comment.
You can’t perform that action at this time.