Introduce an additional lighttpd config file to redirect the IP address and VIRTUAL_HOST to /admin/

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner 2023-01-15 23:48:34 +00:00
parent 2c04346411
commit 4c240a43d2
No known key found for this signature in database
3 changed files with 13 additions and 3 deletions

View File

@ -34,6 +34,7 @@ ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 2
ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME 0
ENV FTLCONF_LOCAL_IPV4 0.0.0.0
ENV VIRTUAL_HOST ""
ENV FTL_CMD no-daemon
ENV DNSMASQ_USER pihole

View File

@ -0,0 +1,8 @@
$HTTP["url"] == "/" {
$HTTP["host"] == env.VIRTUAL_HOST {
url.redirect = ("" => "/admin/")
}
$HTTP["host"] == env.FTLCONF_LOCAL_IPV4 {
url.redirect = ("" => "/admin/")
}
}

View File

@ -348,9 +348,10 @@ setup_lighttpd_bind() {
}
setup_web_php_env() {
if [ -z "$VIRTUAL_HOST" ] ; then
VIRTUAL_HOST="$FTLCONF_LOCAL_IPV4"
fi;
# if the environment variable VIRTUAL_HOST is not set, or is empty, then set it to the IP address of the container
if [ -z "${VIRTUAL_HOST}" ] || [ "${VIRTUAL_HOST}" == "" ]; then
VIRTUAL_HOST="${FTLCONF_LOCAL_IPV4}"
fi
for config_var in "VIRTUAL_HOST" "CORS_HOSTS" "PHP_ERROR_LOG" "PIHOLE_DOCKER_TAG" "TZ"; do
local beginning_of_line=" \"${config_var}\" => "