fix: gateway script issue

This commit is contained in:
Furqan-14
2026-05-27 12:47:38 +05:30
parent 3cc8ad17b1
commit 313801b08c
+27 -1
View File
@@ -17,7 +17,33 @@ if ($Port -le 0) {
Write-Host "Starting FastAPI Gateway local dev server on port $Port..." -ForegroundColor Cyan Write-Host "Starting FastAPI Gateway local dev server on port $Port..." -ForegroundColor Cyan
Push-Location $gatewayDir Push-Location $gatewayDir
try { try {
# Check if virtual environment exists, if not, bootstrap it
if (-not (Test-Path ".venv")) {
Write-Host "Python virtual environment not found. Bootstrapping gateway environment..." -ForegroundColor Yellow
# Verify Python is installed
if (-not (Get-Command python -ErrorAction SilentlyContinue)) {
Write-Error "Python was not found on your PATH. Please install Python 3.11+ and try again."
return
}
Write-Host "Creating virtual environment in $gatewayDir\.venv..." -ForegroundColor Yellow
& python -m venv .venv
if ($LASTEXITCODE -ne 0 -or -not (Test-Path ".venv")) {
Write-Error "Failed to create Python virtual environment."
return
}
Write-Host "Installing gateway dependencies (pip install -e '.[dev]')..." -ForegroundColor Yellow
& .venv\Scripts\pip install -e ".[dev]"
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to install gateway dependencies."
return
}
Write-Host "Bootstrap complete!" -ForegroundColor Green
}
& .venv\Scripts\uvicorn app.main:app --reload --port $Port & .venv\Scripts\uvicorn app.main:app --reload --port $Port
} finally { } finally {
Pop-Location Pop-Location
} }