From 4dd2319eca0081220ff1b578a5a474ef51cebe3c Mon Sep 17 00:00:00 2001 From: AIIrondev Date: Wed, 15 Jul 2026 21:51:27 +0200 Subject: [PATCH] changes to allow a reset --- Website/launch.sh | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Website/launch.sh b/Website/launch.sh index 6d98d58..a9a7e4e 100755 --- a/Website/launch.sh +++ b/Website/launch.sh @@ -66,7 +66,7 @@ if (!appDb.getUser(appUser)) { return 0 fi - echo "[WARNUNG] App-User konnte nicht synchronisiert werden; der bestehende Mongo-Volume-Stand verwendet wahrscheinlich andere Root-Credentials." >&2 + echo "[WARNUNG] App-User konnte nicht synchronisiert werden; der bestehende Mongo-Volume-Stand verwendet wahrscheinlich andere Root-Credentials. Falls das ein frischer Dev-Stand ist, starte mit MONGO_RESET_DATA=1 neu." >&2 return 0 } @@ -133,6 +133,26 @@ compose() { "${DOCKER_CMD[@]}" compose --env-file "$SECRETS_FILE" "$@" } +is_truthy() { + case "${1:-}" in + 1|true|TRUE|yes|YES|on|ON) + return 0 + ;; + *) + return 1 + ;; + esac +} + +reset_mongo_data_if_requested() { + if ! is_truthy "${MONGO_RESET_DATA:-0}"; then + return 0 + fi + + echo "[WARNUNG] Setze den MongoDB-Volume-Stand zurück, damit die aktuellen Secrets neu initialisiert werden." >&2 + "${DOCKER_CMD[@]}" compose --env-file "$SECRETS_FILE" down -v --remove-orphans +} + build_website_image() { if compose build website; then return 0 @@ -163,6 +183,8 @@ fi resolve_docker_cmd +reset_mongo_data_if_requested + build_website_image compose up -d mongodb wait_for_mongo_ready