Skip to content
Permalink
Browse files

[dbmanager] PG ignore env if service file is used

Fixes #14436

Funded by Boundless
  • Loading branch information
Alessandro Pasotti
Alessandro Pasotti committed Apr 12, 2016
1 parent 4dba5eb commit 212b125a2c2eba93f2c8e3b991ea4be4fdc57623
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:
self.dbname = uri.database() or os.environ.get('PGDATABASE') or username
uri.setDatabase(self.dbname)
if username is None:

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Apr 12, 2016

Member

Should this check happen 3 lines above so it can potentially be used as dbname?

username = os.environ.get('USER')

expandedConnInfo = self._connectionInfo()
try:

1 comment on commit 212b125

@elpaso

This comment has been minimized.

Copy link
Contributor

@elpaso elpaso commented on 212b125 Apr 12, 2016

Yes, good catch.

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