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/ctl.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gn3/api/ctl.py') diff --git a/gn3/api/ctl.py b/gn3/api/ctl.py index ac33d63..39c286f 100644 --- a/gn3/api/ctl.py +++ b/gn3/api/ctl.py @@ -2,7 +2,7 @@ from flask import Blueprint from flask import request -from flask import jsonify +from flask import jsonify, current_app from gn3.computations.ctl import call_ctl_script @@ -18,7 +18,8 @@ def run_ctl(): """ ctl_data = request.json - (cmd_results, response) = call_ctl_script(ctl_data) + (cmd_results, response) = call_ctl_script( + ctl_data, current_app.config["TMPDIR"]) return (jsonify({ "results": response }), 200) if response is not None else (jsonify({"error": str(cmd_results)}), 401) -- cgit 1.4.1