Skip to content
Snippets Groups Projects
Commit a9e8fb9f authored by Daan Bijl's avatar Daan Bijl
Browse files

modificatoin: allow for local postgresql database ports other than the default '5432'

parent ac1c84be
No related branches found
No related tags found
No related merge requests found
...@@ -40,9 +40,14 @@ def _config_local_db(readonly): ...@@ -40,9 +40,14 @@ def _config_local_db(readonly):
user = cfg['local_database.user'] user = cfg['local_database.user']
passwd = cfg['local_database.password'] passwd = cfg['local_database.password']
dbname = cfg['local_database.database'] dbname = cfg['local_database.database']
SQL_conn_info_local('localhost', 5432, address = cfg.get("local_database.address", default="localhost:5432")
host, port = address.split(":")
if host != "localhost":
raise RuntimeError("Illegal host name '{}' for local database. Should be 'localhost'.".format(host))
SQL_conn_info_local(host, int(port),
user, passwd, dbname, user, passwd, dbname,
readonly) readonly)
print("connecting to host '{}' at port '{}' to database '{}'".format(host, port, dbname))
def _connect(): def _connect():
global _connected global _connected
...@@ -51,4 +56,4 @@ def _connect(): ...@@ -51,4 +56,4 @@ def _connect():
query_for_samples.get_projects() query_for_samples.get_projects()
_connected = True _connected = True
except: except:
raise raise
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment