-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-api.bat
More file actions
64 lines (54 loc) · 1.44 KB
/
Copy pathstart-api.bat
File metadata and controls
64 lines (54 loc) · 1.44 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
@echo off
setlocal
cd /d "%~dp0"
if exist ".env" (
for /f "usebackq eol=# tokens=1,* delims==" %%A in (".env") do (
if not "%%A"=="" if not defined %%A set "%%A=%%B"
)
)
set "HOST=127.0.0.1"
set "PORT=8100"
if not "%BIRDMARK_API_HOST%"=="" set "HOST=%BIRDMARK_API_HOST%"
if not "%BIRDMARK_API_PORT%"=="" set "PORT=%BIRDMARK_API_PORT%"
set "URL=http://%HOST%:%PORT%"
set "PY=.venv\Scripts\python.exe"
if "%PYTHONPATH%"=="" (
set "PYTHONPATH=%CD%"
) else (
set "PYTHONPATH=%CD%;%PYTHONPATH%"
)
echo [Birdmark API] Working directory: %CD%
if not exist "%PY%" (
echo [Birdmark API] Creating virtual environment...
py -3 -m venv .venv
if errorlevel 1 (
python -m venv .venv
)
if errorlevel 1 (
echo [Birdmark API] Failed to create .venv.
pause
exit /b 1
)
)
echo [Birdmark API] Checking dependencies...
"%PY%" -c "import fastapi, uvicorn, multipart, httpx, PIL" >nul 2>&1
if errorlevel 1 (
echo [Birdmark API] Installing API dependencies...
"%PY%" -m pip install -r apps\api\requirements.txt
if errorlevel 1 (
echo [Birdmark API] Failed to install API dependencies.
pause
exit /b 1
)
)
if /I "%BIRDMARK_CHECK_ONLY%"=="1" (
echo [Birdmark API] Preflight checks passed.
exit /b 0
)
echo [Birdmark API] Starting business API at %URL% ...
"%PY%" -m uvicorn apps.api.app.main:app --host %HOST% --port %PORT%
set "EXIT_CODE=%ERRORLEVEL%"
echo.
echo [Birdmark API] Service stopped.
pause
exit /b %EXIT_CODE%