mirror of
https://github.com/Sudo-JHare/FHIRFLARE-IG-Toolkit.git
synced 2025-11-05 13:35:15 +00:00
Hotifx
fix context relative path.
This commit is contained in:
parent
189ba1d18c
commit
5a6f2072d7
29
app.py
29
app.py
@ -5,6 +5,7 @@ CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))
|
||||
# Introduce app_dir variable that can be overridden by environment
|
||||
app_dir = os.environ.get('APP_DIR', CURRENT_DIR)
|
||||
sys.path.append(CURRENT_DIR)
|
||||
#sys.path.append(os.path.abspath(os.path.dirname(__file__)))
|
||||
import datetime
|
||||
import shutil
|
||||
import queue
|
||||
@ -2402,19 +2403,21 @@ def api_retrieve_bundles():
|
||||
output_zip = os.path.join(temp_dir, zip_filename)
|
||||
|
||||
def generate():
|
||||
try:
|
||||
yield from services.retrieve_bundles(
|
||||
fhir_server_url=fhir_server_url,
|
||||
resources=resources,
|
||||
output_zip=output_zip,
|
||||
validate_references=validate_references,
|
||||
fetch_reference_bundles=fetch_reference_bundles,
|
||||
auth_type=auth_type,
|
||||
auth_token=auth_token
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(f"Error in retrieve_bundles: {e}", exc_info=True)
|
||||
yield json.dumps({"type": "error", "message": f"Unexpected error: {str(e)}"}) + "\n"
|
||||
# Push the application context manually for the generator's lifetime
|
||||
with app.app_context():
|
||||
try:
|
||||
yield from services.retrieve_bundles(
|
||||
fhir_server_url=fhir_server_url,
|
||||
resources=resources,
|
||||
output_zip=output_zip,
|
||||
validate_references=validate_references,
|
||||
fetch_reference_bundles=fetch_reference_bundles,
|
||||
auth_type=auth_type,
|
||||
auth_token=auth_token
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(f"Error in retrieve_bundles: {e}", exc_info=True)
|
||||
yield json.dumps({"type": "error", "message": f"Unexpected error: {str(e)}"}) + "\n"
|
||||
|
||||
response = Response(generate(), mimetype='application/x-ndjson')
|
||||
response.headers['X-Zip-Path'] = os.path.join('/tmp', zip_filename)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user