add command-line options for Uvicorn server configuration

This commit is contained in:
kstyagi23
2026-09-05 06:15:18 +05:30
parent c4facda5ce
commit 48402f7d61
3 changed files with 83 additions and 5 deletions
+14 -3
View File
@@ -41,10 +41,21 @@ siteharbor
Open `http://127.0.0.1:8787`.
The `siteharbor` command runs the FastAPI application with Uvicorn. Override the bind port and
start multiple Uvicorn worker processes when needed:
```powershell
siteharbor --port 9000 --workers 2
```
`--port` accepts ports from 1 through 65535 and overrides `SITEHARBOR_PORT`. `--workers` defaults
to 1 and controls Uvicorn processes, not the capture-worker count configured by
`SITEHARBOR_WORKER_CONCURRENCY`.
To use Uvicorn directly:
```powershell
python -m uvicorn app.main:app --host 127.0.0.1 --port 8787
python -m uvicorn app.main:app --host 127.0.0.1 --port 8787 --workers 2
```
The default bind address is loopback. Do not expose SiteHarbor directly to the public Internet without authentication, a network egress policy, rate limits, and operational controls.
@@ -56,9 +67,9 @@ All configuration uses environment variables prefixed with `SITEHARBOR_`.
| Variable | Default | Purpose |
| --- | --- | --- |
| `SITEHARBOR_HOST` | `127.0.0.1` | Bind address used by `siteharbor`. |
| `SITEHARBOR_PORT` | `8787` | Bind port used by `siteharbor`. |
| `SITEHARBOR_PORT` | `8787` | Default bind port used by `siteharbor`; overridden by `--port`. |
| `SITEHARBOR_DATA_DIR` | `./data` | SQLite database, work directories, artifacts, and reports. |
| `SITEHARBOR_WORKER_CONCURRENCY` | `1` | Capture workers per application process. |
| `SITEHARBOR_WORKER_CONCURRENCY` | `1` | Capture workers per Uvicorn process; separate from `--workers`. |
| `SITEHARBOR_FETCH_CONCURRENCY` | `6` | Maximum parallel fetches a visitor may select for one capture. |
| `SITEHARBOR_LEASE_SECONDS` | `120` | SQLite worker lease duration; values below 15 seconds are rejected. |
| `SITEHARBOR_ALLOW_PRIVATE_NETWORKS` | `false` | Development-only override that permits loopback and private hosts. |