Merge pull request 'fix: gateway script issue' (#25) from furqan into dev
Reviewed-on: https://gitea.maskantech.in/gitea_admin/pdf/pulls/25
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user