Repository navigation
Expand file tree
/
Copy pathstart.bat
More file actions
51 lines (44 loc) · 1.35 KB
/
Copy pathstart.bat
File metadata and controls
51 lines (44 loc) · 1.35 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
@echo off
REM ================================================
REM start.bat — Start the FastAPI server (Windows)
REM ================================================
echo.
echo ========================================
echo FastAPI Server Starting
echo ========================================
REM Load .env file if it exists
if exist ".env" (
echo Loading config from .env...
for /f "usebackq tokens=1,2 delims==" %%A in (".env") do (
set "%%A=%%B"
)
echo Loaded .env successfully
) else (
echo No .env file found. Copying from .env.example...
copy .env.example .env
)
REM Defaults if not set
if not defined HOST set HOST=0.0.0.0
if not defined PORT set PORT=8000
if not defined WORKERS set WORKERS=1
if not defined LOG_LEVEL set LOG_LEVEL=info
echo.
echo Host : %HOST%
echo Port : %PORT%
echo Workers : %WORKERS%
echo Log Level : %LOG_LEVEL%
echo.
echo Swagger UI : http://%HOST%:%PORT%/docs
echo ReDoc : http://%HOST%:%PORT%/redoc
echo Health : http://%HOST%:%PORT%/health
echo ========================================
echo.
REM Install dependencies if needed
python -c "import fastapi" 2>nul
if errorlevel 1 (
echo Installing dependencies...
pip install -r requirements.txt
)
REM Start hypercorn
hypercorn main:app --bind "%HOST%:%PORT%" --workers %WORKERS% --log-level %LOG_LEVEL%
pause