From d2c21bc519c7962d020cc886840bafb56a0b7846 Mon Sep 17 00:00:00 2001 From: AIIrondev Date: Wed, 26 Aug 2026 22:55:56 +0200 Subject: [PATCH] New password option fo the tenant adding and heatlth check --- Web/app.py | 2 +- manage-tenant.sh | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Web/app.py b/Web/app.py index b789772..e2e8d93 100755 --- a/Web/app.py +++ b/Web/app.py @@ -13163,7 +13163,7 @@ def get_optimal_image_quality(img, target_size_kb=80): @app.route('/health') def health_check(): - return 'OK', 200 + return jsonify({"status": "healthy"}), 200 @app.route('/api/push/subscribe', methods=['POST']) diff --git a/manage-tenant.sh b/manage-tenant.sh index e131a70..601af5e 100755 --- a/manage-tenant.sh +++ b/manage-tenant.sh @@ -439,7 +439,8 @@ initialize_tenant_database() { return 0 fi - docker exec -i "$APP_CONTAINER" python3 - "$tenant_id" "$mode" "$admin_password" <<'PY' + # Fix: We inject the password securely via a temporary environment variable (-e ADMIN_PASS) + docker exec -i -e ADMIN_PASS="$admin_password" "$APP_CONTAINER" python3 - "$tenant_id" "$mode" <<'PY' import sys, os, re, datetime, hashlib sys.path.insert(0, "/app") sys.path.insert(0, "/app/Web") @@ -450,7 +451,12 @@ import Web.modules.database.user as us tenant_id = sys.argv[1].lower() mode = sys.argv[2] -admin_password = sys.argv[3] if len(sys.argv) > 3 else "admin123" + +# Fix: Read the password directly from the environment variable instead of sys.argv +admin_password = os.environ.get("ADMIN_PASS", "admin123") +# Failsafe in case of empty string +if not admin_password.strip(): + admin_password = "admin123" sanitized = "".join(c for c in tenant_id if c.isalnum() or c == "_") db_name = f"inventar_{sanitized}" if sanitized else settings.MONGODB_DB