From e6e046fc7a323ef3434c43c69d6be84de6ff9cbf Mon Sep 17 00:00:00 2001 From: Paul F Bugni Date: Tue, 10 Oct 2023 15:26:44 -0700 Subject: [PATCH] add `DEBUG_FHIR_REQUESTS` config should we need to debug the requests being routed to the FHIR server, again. --- confidential_backend/api/fhir.py | 8 ++++++-- confidential_backend/config.py | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/confidential_backend/api/fhir.py b/confidential_backend/api/fhir.py index 59da746a..2ad2b8a1 100644 --- a/confidential_backend/api/fhir.py +++ b/confidential_backend/api/fhir.py @@ -78,8 +78,12 @@ def route_fhir(relative_path, session_id): if header_name in request.headers: upstream_headers[header_name] = request.headers[header_name] - current_app.logger.debug(f'request headers (incoming to /fhir-router): {request.headers}') - current_app.logger.debug(f'upstream headers (outgoing to {upstream_fhir_url}): {upstream_headers} ;;; params: {request.args} ;;; json: {request.json}') + if current_app.config['DEBUG_FHIR_REQUESTS']: + current_app.logger.debug( + f'request headers (incoming to /fhir-router): {request.headers}') + current_app.logger.debug( + f'upstream headers (outgoing to {upstream_fhir_url}): ' + f'{upstream_headers} ;;; params: {request.args} ;;; json: {request.json}') upstream_response = requests.request( url=upstream_fhir_url, diff --git a/confidential_backend/config.py b/confidential_backend/config.py index 57731dc0..f7afbc96 100644 --- a/confidential_backend/config.py +++ b/confidential_backend/config.py @@ -6,6 +6,7 @@ import redis AUTH_TOKEN_LOG_FILTER = os.getenv("AUTH_TOKEN_LOG_FILTER").split(",") if "AUTH_TOKEN_LOG_FILTER" in os.environ else None +DEBUG_FHIR_REQUESTS = os.getenv("DEBUG_FHIR_REQUESTS", "false").lower() == "true" DEBUG_OUTPUT_DIR = os.getenv("DEBUG_OUTPUT_DIR", '/tmp') SERVER_NAME = os.getenv("SERVER_NAME") SECRET_KEY = os.getenv("SECRET_KEY")