add check to enable /setup deployment
All checks were successful
build container icingaweb2 / build (push) Successful in 3m54s

This commit is contained in:
2025-02-01 14:49:58 +01:00
parent b7f61a0663
commit 4656400214

18
init.sh
View File

@@ -6,6 +6,7 @@ ICINGAWEB2_PORT=8080
## init icinga config files if need
if [ -z "$(ls -A /data)" ]; then
# enable python script for inital deployments
ICINGAWEB2_CONF_ONCE=false
export INIT_DB=true
@@ -14,9 +15,17 @@ if [ -z "$(ls -A /data)" ]; then
cp -ax /data-init/* /data
rm -rf /data-init
## enable modules
icingacli module enable icingadb
mkdir -p /etc/icingaweb2/modules/icingadb/
## check if a var exist they is must have for deployment
## because without this check, moduls init everytime and this blocks /setup page
if [ ! -z "$ICINGAWEB2_DEFAULT_ADMIN_USER" ]; then
## enable modules
icingacli module enable icingadb
mkdir -p /etc/icingaweb2/modules/icingadb/
else
## print setup token because no auto deployment will run
icingacli setup token create;
fi
fi
## apache setup
@@ -27,7 +36,8 @@ if [ ! -z "$ICINGAWEB2_PORT" ]; then
fi
## edit icingaweb2 config only on first setup or is enabled
if [ ! $ICINGAWEB2_CONF_ONCE ] || [ "$ICINGAWEB2_CONF_ONCE" = false ]; then
if { [ -z "${ICINGAWEB2_CONF_ONCE+x}" ] || [ "$ICINGAWEB2_CONF_ONCE" = "false" ]; } \
&& [ -n "${ICINGAWEB2_DEFAULT_ADMIN_USER+x}" ]; then
/usr/bin/python3 /root/conf_icingaweb2.py
fi