aboutsummaryrefslogtreecommitdiff
path: root/gn3/db_utils.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-03-23 09:12:53 +0300
committerFrederick Muriuki Muriithi2023-03-23 09:12:53 +0300
commitde20ab3834f2a84fd3f2ba9657650e28898e27f0 (patch)
tree0d552a563eeddcdf4b7f27d0725df6436677ef22 /gn3/db_utils.py
parentdfc0c9fd051000afed95547e36aa494520b096f0 (diff)
downloadgenenetwork3-de20ab3834f2a84fd3f2ba9657650e28898e27f0.tar.gz
conf: use flask.current_app.config not in gn3.settings
The configuration in gn3.settings can (and does) get overwritten by values in the environment variable `GN3_CONF` and any configurations passed in the call to the `gn3.app.create_app` function; as such, this commit changes the configuration used in the code to user the final configuration values that are in the running application's `flask.current_app.config` object.
Diffstat (limited to 'gn3/db_utils.py')
-rw-r--r--gn3/db_utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/gn3/db_utils.py b/gn3/db_utils.py
index ad934d7..862d76c 100644
--- a/gn3/db_utils.py
+++ b/gn3/db_utils.py
@@ -4,14 +4,14 @@ from typing import Any, Iterator, Protocol, Tuple
from urllib.parse import urlparse
import MySQLdb as mdb
import xapian
-from gn3.settings import SQL_URI
+from flask import current_app
def parse_db_url() -> Tuple:
"""function to parse SQL_URI env variable note:there\
is a default value for SQL_URI so a tuple result is\
always expected"""
- parsed_db = urlparse(SQL_URI)
+ parsed_db = urlparse(current_app.config["SQL_URI"])
return (
parsed_db.hostname, parsed_db.username, parsed_db.password,
parsed_db.path[1:], parsed_db.port)