From 5ef75b292b015392ecb3e918a129f68f346a743c Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <ardumont@softwareheritage.org>
Date: Wed, 14 Aug 2024 13:24:43 +0200
Subject: [PATCH] graphql: Allow gunicorn logging config to be effective

Refs. swh/infra/sysadm-environment#5327
---
 apps/swh-graphql/entrypoint.sh    | 5 +++++
 apps/swh-graphql/requirements.txt | 1 +
 2 files changed, 6 insertions(+)

diff --git a/apps/swh-graphql/entrypoint.sh b/apps/swh-graphql/entrypoint.sh
index 2c70de5f8..e52e44425 100644
--- a/apps/swh-graphql/entrypoint.sh
+++ b/apps/swh-graphql/entrypoint.sh
@@ -7,9 +7,14 @@ case "$1" in
         exec bash -i
         ;;
     *)
+        EXTRA_CLI_FLAGS=""
+        if [ ! -z "${SWH_LOG_CONFIG_JSON}" ]; then
+            EXTRA_CLI_FLAGS="--log-config-json ${SWH_LOG_CONFIG_JSON}"
+        fi
         echo Starting the swh-graphql API server
         exec gunicorn --bind 0.0.0.0:${PORT} \
              --log-level ${SWH_LOG_LEVEL:-INFO} \
+             ${EXTRA_CLI_FLAGS} \
              --threads ${THREADS} \
              --workers ${WORKERS} \
              --timeout ${TIMEOUT} \
diff --git a/apps/swh-graphql/requirements.txt b/apps/swh-graphql/requirements.txt
index 61104e2c1..4bd3f0f78 100644
--- a/apps/swh-graphql/requirements.txt
+++ b/apps/swh-graphql/requirements.txt
@@ -6,3 +6,4 @@ h11
 starlette
 typing-extensions
 swh-graphql
+python-json-logger
-- 
GitLab