diff --git a/init.sh b/init.sh index af7f74f..7bc220d 100644 --- a/init.sh +++ b/init.sh @@ -23,6 +23,12 @@ if [ -z "$(ls -A /data)" ]; then mv $ICINGA2_CONF_DIR/*.conf $ICINGA2_GLOBAL_TEMPLATES/ mv $ICINGA2_GLOBAL_TEMPLATES/api-users.conf $ICINGA2_CONF_DIR/ + ## only on inital setup replace one time the api root user password if a env var is set + if [ ! -z "$ICINGA2_API_USER_ROOT_PASS" ]; then + echo set inital api root user password + sed -i "s|password = \".*\"|password = \"$ICINGA2_API_USER_ROOT_PASS\"|g" $ICINGA2_FILE_API_USER_CONF + fi + ## only on inital setup create a icingaweb api user if env var is set ## permission source: https://icinga.com/docs/icinga-web/latest/modules/monitoring/doc/05-Command-Transports/ if [ ! -z "$ICINGA2_API_USER_ICINGAWEB_PASS" ]; then @@ -44,11 +50,6 @@ if [ -z "$(ls -A /data)" ]; then fi - ## only on inital setup replace one time the api root user password if a env var is set - if [ ! -z "$ICINGA2_API_USER_ROOT_PASS" ]; then - echo set inital api root user password - sed -i "s|password = \".*\"|password = \"$ICINGA2_API_USER_ROOT_PASS\"|g" $ICINGA2_FILE_API_USER_CONF - fi fi