Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[dbmanager] PG ignore env if service file is used
Fixes #14436

Funded by Boundless
  • Loading branch information
Alessandro Pasotti committed Apr 12, 2016
1 parent 4dba5eb commit 212b125
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions python/plugins/db_manager/db_plugins/postgis/connector.py
Expand Up @@ -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:
Expand Down

1 comment on commit 212b125

@elpaso
Copy link
Contributor

@elpaso elpaso commented on 212b125 Apr 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good catch.

Please sign in to comment.