fix: longer wait for sys.db, fallback to touch + userCount check

This commit is contained in:
Claus Lohmar 2026-07-07 16:33:49 +01:00
parent c42807d076
commit fa9537bcb5

View file

@ -258,10 +258,15 @@ EOF
echo "[*] Configuring Zoraxy..."
SYS_DB="$TARGET_DIR/data/zoraxy/sys.db"
# Wait for Zoraxy to create the database
for i in $(seq 1 20); do
# Wait for Zoraxy to create the database (or timeout)
for i in $(seq 1 30); do
if [ -f "$SYS_DB" ]; then break; fi
sleep 1
if curl -sf "http://127.0.0.1:8000/api/auth/userCount" > /dev/null 2>&1; then
# Zoraxy is up, create db file if it doesn't exist yet
touch "$SYS_DB" 2>/dev/null || true
break
fi
sleep 2
done
# Write admin user directly to BoltDB via helper tool
@ -271,6 +276,8 @@ EOF
"$TOOL_BIN" db --db "$SYS_DB" \
--set "zorxauth:options:{\"enable_auth_gateway\":true,\"sso_redirect_url\":\"https://app.${DOMAIN}/\"}" 2>&1 || true
echo " [OK] Admin + ZorxAuth written to BoltDB"
else
echo " [WARN] Could not write to BoltDB (sys.db or tool missing)"
fi
# Write ACME config file directly