-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.bat
More file actions
83 lines (72 loc) · 2.46 KB
/
Copy pathrun.bat
File metadata and controls
83 lines (72 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
@echo off
setlocal
chcp 65001 >nul
echo ========================================
echo Starting KiroProxy Service...
echo ========================================
REM Default port is 6696 (override: set PORT env or run.bat 6696)
if not defined PORT set "PORT=6696"
if not "%~1"=="" set "PORT=%~1"
REM Set admin password (optional, leave empty for no login required)
REM If ADMIN_PASSWORD is already set in system environment, it won't be overwritten
if not defined ADMIN_PASSWORD set ADMIN_PASSWORD=
REM Find Python command (prefer python, fallback to py -3)
where python >nul 2>&1
if not errorlevel 1 (
set PYTHON=python
) else (
where py >nul 2>&1
if not errorlevel 1 (
set PYTHON=py -3
) else (
echo Python not found. Please install Python and add to PATH.
goto end
)
)
echo [1/3] Starting service... (PORT=%PORT%)
start "" /B %PYTHON% run.py %PORT%
echo [2/3] Waiting for service...
set /a count=0
set /a max_attempts=30
:check_service
set /a count+=1
echo Checking service status... (%count%/%max_attempts%)
REM Use curl to check if service is available (fallback to powershell)
curl -s -o nul -w "%%{http_code}" http://127.0.0.1:%PORT% 2>nul | findstr "200" >nul
if not errorlevel 1 (
echo [3/3] Service ready, opening browser...
timeout /t 1 /nobreak >nul
start http://127.0.0.1:%PORT%
echo.
echo ========================================
echo KiroProxy started successfully!
echo Web address: http://127.0.0.1:%PORT%
echo ========================================
goto end
)
REM If curl is not available, use PowerShell
powershell -Command "try { $response = Invoke-WebRequest -Uri 'http://127.0.0.1:%PORT%' -TimeoutSec 2 -UseBasicParsing; if ($response.StatusCode -eq 200) { exit 0 } else { exit 1 } } catch { exit 1 }" >nul 2>&1
if not errorlevel 1 (
echo [3/3] Service ready, opening browser...
timeout /t 1 /nobreak >nul
start http://127.0.0.1:%PORT%
echo.
echo ========================================
echo KiroProxy started successfully!
echo Web address: http://127.0.0.1:%PORT%
echo ========================================
goto end
)
if %count% lss %max_attempts% (
timeout /t 2 /nobreak >nul
goto check_service
)
echo.
echo ========================================
echo Warning: Service startup timeout
echo Please visit: http://127.0.0.1:%PORT%
echo ========================================
:end
if "%KIROPROXY_NO_PAUSE%"=="1" exit /b 0
pause
endlocal