This commit is contained in:
2026-03-25 22:03:39 +01:00
parent a0073b4fb1
commit faf4ca10c9
5603 changed files with 1030866 additions and 79 deletions

View File

@@ -0,0 +1,45 @@
@echo off
setlocal EnableExtensions
cd /d "%~dp0"
set "BACKEND_URL=http://127.0.0.1:8000"
set "BACKEND_HEALTH=%BACKEND_URL%/health"
set "READY_TIMEOUT_SEC=45"
set "TOKENFILE=%~dp0backend_token.txt"
REM ---- kill any python using port 8000 (simple & robust)
for /f "tokens=5" %%P in ('netstat -ano ^| findstr :8000') do taskkill /F /PID %%P >nul 2>&1
REM ---- ensure logs folder
if not exist logs mkdir logs
REM ---- ensure backend token for API auth
if not exist "%TOKENFILE%" (
echo dev-secret-2026> "%TOKENFILE%"
)
set "BACKEND_TOKEN="
set /p BACKEND_TOKEN=<"%TOKENFILE%"
if "%BACKEND_TOKEN%"=="" set "BACKEND_TOKEN=dev-secret-2026"
REM ---- start backend in background
start "" /B cmd /c "set MEDWORK_API_TOKEN=%BACKEND_TOKEN%&& python backend_main.py 1>logs\backend.log 2>&1"
REM ---- wait until backend is really reachable
python "%~dp0tools\wait_http_ready.py" "%BACKEND_HEALTH%" %READY_TIMEOUT_SEC% >nul 2>&1
if errorlevel 1 goto backend_timeout
goto backend_ready
:backend_timeout
echo FEHLER: Backend nicht erreichbar nach %READY_TIMEOUT_SEC%s (^%BACKEND_HEALTH%^)
echo Siehe Logs: logs\backend.log
endlocal
exit /b 2
:backend_ready
REM ---- write backend url
echo %BACKEND_URL%> backend_url.txt
endlocal
exit /b 0