fix: updated port
This commit is contained in:
+26
-4
@@ -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).
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user