Skip to content

Commit

Permalink
Added 'hostaddr' and used host string as it is while creating SSHTunnel.
Browse files Browse the repository at this point in the history
  • Loading branch information
akshay-joshi committed Oct 12, 2023
1 parent 3a62fc5 commit 81dcc91
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions web/pgadmin/utils/driver/psycopg3/server_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,14 +652,15 @@ def create_connection_string(self, database, user, password=None):
parameters.
"""
dsn_args = dict()
dsn_args['host'] = \
self.local_bind_host if self.use_ssh_tunnel else self.host
dsn_args['host'] = self.host
dsn_args['port'] = \
self.local_bind_port if self.use_ssh_tunnel else self.port
dsn_args['dbname'] = database
dsn_args['user'] = user
if self.service is not None:
dsn_args['service'] = self.service
if self.use_ssh_tunnel:
dsn_args['hostaddr'] = self.local_bind_host

# Make a copy to display the connection string on GUI.
display_dsn_args = dsn_args.copy()
Expand All @@ -680,10 +681,9 @@ def create_connection_string(self, database, user, password=None):
with_complete_path = True
value = get_complete_file_path(value)

# In case of host address need to check ssh tunnel flag.
if key == 'hostaddr':
value = self.local_bind_host if self.use_ssh_tunnel else \
value
# If key is hostaddr and ssh tunnel is in use don't overwrite.
if key == 'hostaddr' and self.use_ssh_tunnel:
continue

dsn_args[key] = value
display_dsn_args[key] = orig_value if with_complete_path else \
Expand Down

0 comments on commit 81dcc91

Please sign in to comment.