From 05013c13710eccadb69746bf186eb672c2af69c4 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 22 Oct 2025 13:27:54 -0500 Subject: Fetch configs from app setting and pass them down Fix the code to avoid using global variables holding configuration variables to avoid the failures caused by action-at-a-distance effects due to change of a value elsewhere. This way, all code consistently receives the same configuration values passed on from callers. We pass on the following configuration settings: * TMPDIR * SQL_URI * TEXTDIR --- gn3/api/correlation.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gn3/api/correlation.py') diff --git a/gn3/api/correlation.py b/gn3/api/correlation.py index 6af96d7..3667a24 100644 --- a/gn3/api/correlation.py +++ b/gn3/api/correlation.py @@ -9,7 +9,6 @@ from flask import Blueprint from flask import request from flask import current_app -from gn3.settings import SQL_URI from gn3.db_utils import database_connection from gn3.commands import run_sample_corr_cmd from gn3.responses.pcorrs_responses import build_response @@ -144,7 +143,10 @@ def partial_correlation(): cmd=command, job_queue=compute_job_queue(current_app), options={ - "env": {"PYTHONPATH": ":".join(sys.path), "SQL_URI": SQL_URI}, + "env": { + "PYTHONPATH": ":".join(sys.path), + "SQL_URI": current_app.config["SQL_URI"] + }, }, log_level=logging.getLevelName( current_app.logger.getEffectiveLevel()).lower()) -- cgit 1.4.1