From 17797a52032b13e6dea0958490c63c7c090589fd Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Fri, 29 Apr 2022 13:54:28 +0100
Subject: [PATCH] Make LogLevel configurable from env (2nd attempt)

---
 build.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/build.sh b/build.sh
index 6fe7559..a95fe50 100755
--- a/build.sh
+++ b/build.sh
@@ -60,9 +60,12 @@ rsync -a /tmp/conf/ /etc/
 # Set the Apache syslog program
 APACHE_SYSLOG_TAG_DEFAULT=apache
 echo "export APACHE_SYSLOG_TAG=\${APACHE_SYSLOG_TAG:-${APACHE_SYSLOG_TAG_DEFAULT}}" >> /etc/apache2/envvars
+echo "export APACHE_LOG_LEVEL=\${APACHE_LOG_LEVEL:-warn}" >> /etc/apache2/envvars
 
 # Fix Apache error logging.
-sed -i -e 's@^ErrorLog.*$@ErrorLog "|/usr/bin/logger -p daemon.error -t \${APACHE_SYSLOG_TAG}"@' /etc/apache2/apache2.conf
+sed -i -e 's@^ErrorLog.*$@ErrorLog "|/usr/bin/logger -p daemon.error -t \${APACHE_SYSLOG_TAG}"@' \
+    -e 's,^LogLevel .*,LogLevel ${APACHE_LOG_LEVEL},' \
+    /etc/apache2/apache2.conf
 
 # Make APACHE_RUN_USER externally configurable (defaults to www-data if unset)
 # and fix some paths used by apache2 to be container-friendly.
-- 
GitLab