Files
icingaweb2/init.sh
anima 09307cc58a
Some checks failed
build container icingaweb2 / build (push) Failing after 4s
inital version
2025-01-31 22:29:17 +01:00

38 lines
1.0 KiB
Bash

#!/bin/bash
ICINGAWEB2_FILE_APACHE_DEFAULT=/etc/apache2/sites-available/000-default.conf
ICINGAWEB2_FILE_APACHE_PORTS=/etc/apache2/ports.conf
ICINGAWEB2_PORT=8080
## init icinga config files if need
if [ -z "$(ls -A /data)" ]; then
ICINGAWEB2_CONF_ONCE=false
export INIT_DB=true
## move init files
echo init icingaweb2 config
cp -ax /data-init/* /data
rm -rf /data-init
## enable modules
icingacli module enable icingadb
mkdir -p /etc/icingaweb2/modules/icingadb/
fi
## apache setup
if [ ! -z "$ICINGAWEB2_PORT" ]; then
echo set icingaweb2 apache ports
sed -i "s|^Listen .*|Listen $ICINGAWEB2_PORT|" $ICINGAWEB2_FILE_APACHE_PORTS
sed -i "s|VirtualHost \*:.*>|VirtualHost \*:$ICINGAWEB2_PORT>|g" $ICINGAWEB2_FILE_APACHE_DEFAULT
fi
## edit icingaweb2 config only on first setup or is enabled
if [ ! $ICINGAWEB2_CONF_ONCE ] || [ "$ICINGAWEB2_CONF_ONCE" = false ]; then
/usr/bin/python3 /root/conf_icingaweb2.py
fi
## init apache
. /etc/apache2/envvars
# run CMD
exec "$@"