Skip to content

Commit

Permalink
Fix disabling SSL for MySQL connection
Browse files Browse the repository at this point in the history
  • Loading branch information
dippindots authored Aug 29, 2023
1 parent 9301ad2 commit bdda8d0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/src/main/scripts/importer/cbioportal_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,13 +1085,16 @@ def get_db_cursor(portal_properties: PortalProperties):

try:
url_elements = dsnparse.parse(portal_properties.database_url)
# use SSL by default if "useSSL" is absent from the configuration file
useSSL = "useSSL" not in url_elements.query or url_elements.query["useSSL"] == "true"
connection_kwargs = {
"host": url_elements.host,
"port": url_elements.port if url_elements.port is not None else 3306,
"db": url_elements.paths[0],
"user": portal_properties.database_user,
"passwd": portal_properties.database_pw,
"ssl": "useSSL" not in url_elements.query or url_elements.query["useSSL"] == "true"
"ssl": useSSL,
"ssl_mode": "REQUIRED" if useSSL or "DISABLED"
}
connection = MySQLdb.connect(**connection_kwargs)
except MySQLdb.Error as exception:
Expand Down

0 comments on commit bdda8d0

Please sign in to comment.