New password option fo the tenant adding and heatlth check
Release Inventarsystem / release-docker (push) Successful in 3m9s
Release Inventarsystem / release-docker (push) Successful in 3m9s
This commit is contained in:
+1
-1
@@ -13163,7 +13163,7 @@ def get_optimal_image_quality(img, target_size_kb=80):
|
|||||||
|
|
||||||
@app.route('/health')
|
@app.route('/health')
|
||||||
def health_check():
|
def health_check():
|
||||||
return 'OK', 200
|
return jsonify({"status": "healthy"}), 200
|
||||||
|
|
||||||
|
|
||||||
@app.route('/api/push/subscribe', methods=['POST'])
|
@app.route('/api/push/subscribe', methods=['POST'])
|
||||||
|
|||||||
+8
-2
@@ -439,7 +439,8 @@ initialize_tenant_database() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
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
|
import sys, os, re, datetime, hashlib
|
||||||
sys.path.insert(0, "/app")
|
sys.path.insert(0, "/app")
|
||||||
sys.path.insert(0, "/app/Web")
|
sys.path.insert(0, "/app/Web")
|
||||||
@@ -450,7 +451,12 @@ import Web.modules.database.user as us
|
|||||||
|
|
||||||
tenant_id = sys.argv[1].lower()
|
tenant_id = sys.argv[1].lower()
|
||||||
mode = sys.argv[2]
|
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 == "_")
|
sanitized = "".join(c for c in tenant_id if c.isalnum() or c == "_")
|
||||||
db_name = f"inventar_{sanitized}" if sanitized else settings.MONGODB_DB
|
db_name = f"inventar_{sanitized}" if sanitized else settings.MONGODB_DB
|
||||||
|
|||||||
Reference in New Issue
Block a user