ALWAYS_FRESH_INSTALL variable

This commit is contained in:
Jokob-sk
2024-02-17 08:51:10 +11:00
parent fdf381d565
commit 87dd1cdf2d
2 changed files with 13 additions and 0 deletions

View File

@@ -63,3 +63,5 @@ services:
- PORT=${PORT}
- HOST_USER_ID=${HOST_USER_ID}
- HOST_USER_GID=${HOST_USER_GID}
# ❗ DANGER ZONE BELOW - Setting ALWAYS_FRESH_INSTALL=true will delete the content of the /db & /config folders
- ALWAYS_FRESH_INSTALL=${ALWAYS_FRESH_INSTALL}

View File

@@ -114,6 +114,17 @@ chmod -R a+rwx $INSTALL_DIR
echo "[INSTALL] Copy starter pialert.db and pialert.conf if they don't exist"
# DANGER ZONE: ALWAYS_FRESH_INSTALL
if [ "$ALWAYS_FRESH_INSTALL" = true ]; then
echo "[INSTALL] ❗ ALERT db and config folders are cleared because the ALWAYS_FRESH_INSTALL is set to: $ALWAYS_FRESH_INSTALL"
# Delete content of "$INSTALL_DIR/pialert/config/"
rm -rf "$INSTALL_DIR/pialert/config/"*
# Delete content of "$FILEDB"
rm -rf "$FILEDB"/*
fi
# Copy starter pialert.db and pialert.conf if they don't exist
cp -n "$INSTALL_DIR/pialert/back/pialert.conf" "$INSTALL_DIR/pialert/config/pialert.conf"
cp -n "$INSTALL_DIR/pialert/back/pialert.db" "$FILEDB"