fix: updated port

This commit is contained in:
Furqan-14
2026-05-27 12:25:00 +05:30
parent b064c2c5dc
commit 3cc8ad17b1
3 changed files with 51 additions and 7 deletions
+26 -4
View File
@@ -57,12 +57,27 @@ pip install -e ".[dev]"
Run the service:
```sh
uvicorn app.main:app --reload
# → http://127.0.0.1:8000/health
# → http://127.0.0.1:8000/docs (OpenAPI UI)
Using the startup script (Windows):
```powershell
# Default port (8000)
powershell -File scripts/start_gateway.ps1
# Custom port (e.g. 8080)
powershell -File scripts/start_gateway.ps1 -Port 8080
```
Or run directly via uvicorn (cross-platform):
```sh
# Default port (8000)
uvicorn app.main:app --reload
# Custom port (e.g. 8080)
uvicorn app.main:app --reload --port 8080
```
# → http://127.0.0.1:<port>/health
# → http://127.0.0.1:<port>/docs (OpenAPI UI)
Lint, format, and test (the exact commands CI runs):
```sh
@@ -81,6 +96,13 @@ Environment variables are read by `app/config.py` with the prefix
| `PDFENGINE_ENVIRONMENT` | `dev` | `dev` / `staging` / `prod` — echoed in `/health` |
| `PDFENGINE_ENGINE_AVAILABLE` | `false` | Forces the engine-availability flag for testing |
Additionally, the gateway startup scripts and frontend configuration support:
| Var | Default | Meaning |
|--------------------|-------------------------|--------------------------------------------------|
| `PORT` | `8000` | Gateway listening port (used by `start_gateway.ps1`). |
| `VITE_GATEWAY_URL` | `http://127.0.0.1:8000` | URL of the gateway API (used by the frontend). |
A `.env` file in `gateway/` is auto-loaded if present (it is git-ignored
via the repo-wide `.venv/` and Python rules — add `.env` to your local
ignores if you keep secrets in it).
+9
View File
@@ -30,6 +30,15 @@ def create_app() -> FastAPI:
app.include_router(edits.router)
app.include_router(edits.compat_router)
@app.get("/")
def read_root():
return {
"name": "PDF Engine Gateway",
"version": __version__,
"health": "/health",
"docs": "/docs"
}
return app
+15 -2
View File
@@ -1,10 +1,23 @@
param (
[int]$Port = 0
)
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$gatewayDir = Join-Path (Split-Path -Parent $scriptDir) "gateway"
Write-Host "Starting FastAPI Gateway local dev server..." -ForegroundColor Cyan
if ($Port -le 0) {
$envPort = $env:PORT -as [int]
if ($envPort) {
$Port = $envPort
} else {
$Port = 8000
}
}
Write-Host "Starting FastAPI Gateway local dev server on port $Port..." -ForegroundColor Cyan
Push-Location $gatewayDir
try {
& .venv\Scripts\uvicorn app.main:app --reload
& .venv\Scripts\uvicorn app.main:app --reload --port $Port
} finally {
Pop-Location
}