allow to adjust the log level for all caddy instances

Signed-off-by: Simon L. <szaimen@e.mail.de>
This commit is contained in:
Simon L.
2026-09-02 10:35:33 +02:00
parent f766295212
commit d268ca2bde
6 changed files with 51 additions and 4 deletions
+14 -1
View File
@@ -1,4 +1,6 @@
{
admin off
auto_https disable_redirects
storage file_system {
@@ -9,8 +11,19 @@
# trusted_proxies placeholder
}
# The endpoint below is plain http on purpose, so limit it to h1 to avoid caddy warning that
# HTTP/2 and HTTP/3 were skipped. Excluding the `http` logger would also hide acme messages.
servers :23973 {
protocols h1
}
# apache-port protocols placeholder
log {
level ERROR
level {$CADDY_LOG_LEVEL}
# Below ERROR, caddy prints 'admin endpoint disabled' on every start, which is expected
# since we set `admin off` above.
exclude admin
}
}
+9
View File
@@ -9,6 +9,8 @@ if [ -z "$NC_DOMAIN" ]; then
exit 1
fi
CADDY_LOG_LEVEL="$(echo "$AIO_LOG_LEVEL" | tr '[:lower:]' '[:upper:]')"
export CADDY_LOG_LEVEL
if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
export AIO_ACCESS_LOG=/proc/self/fd/1
else
@@ -64,6 +66,13 @@ else
fi
echo "$CADDYFILE" > /tmp/Caddyfile
# In case of reverse proxies the APACHE_PORT listener is plain http, so limit it to h1 to avoid
# caddy warning that HTTP/2 and HTTP/3 were skipped. See the Caddyfile for further details.
if [ "$APACHE_PORT" != '443' ]; then
CADDYFILE="$(sed "s|# apache-port protocols placeholder|servers :$APACHE_PORT {\n\t\tprotocols h1\n\t}|" /tmp/Caddyfile)"
echo "$CADDYFILE" > /tmp/Caddyfile
fi
# Remove additional domain if not given
if [ -z "$ADDITIONAL_TRUSTED_DOMAIN" ]; then
CADDYFILE="$(sed '/ADDITIONAL_TRUSTED_DOMAIN/d' /tmp/Caddyfile)"