From 56eb225b53bb80554de5e633b302e9dfd72fa465 Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <ardumont@softwareheritage.org>
Date: Wed, 14 Aug 2024 14:02:12 +0200
Subject: [PATCH] deposit: Allow gunicorn logging config to be effective

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

diff --git a/apps/swh-deposit/entrypoint.sh b/apps/swh-deposit/entrypoint.sh
index 3bfd6aec8..a92dcc527 100644
--- a/apps/swh-deposit/entrypoint.sh
+++ b/apps/swh-deposit/entrypoint.sh
@@ -17,9 +17,14 @@ case "$1" in
         exec swh $@
         ;;
     *)
+        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-deposit 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-deposit/requirements.txt b/apps/swh-deposit/requirements.txt
index 6ec4bb7dd..67b260eab 100644
--- a/apps/swh-deposit/requirements.txt
+++ b/apps/swh-deposit/requirements.txt
@@ -1,2 +1,3 @@
 swh.deposit[server]
 django-storages[azure]
+python-json-logger
-- 
GitLab