Upgrade to kaya 0.0.2 and run on the rloop event loop
CI / Build and push docker image (push) Successful in 1m39s

- pin kaya-core/kaya-rsgi >= 0.0.2 (ctx.client now honors Forwarded and
  X-Forwarded-* headers); adapt route tests and add explicit coverage
- add rloop dependency and set GRANIAN_LOOP=rloop in the Docker image so
  granian serves the app on the Rust event loop instead of asyncio
- regenerate requirements.txt (kaya 0.0.2, rloop 0.5.0)
- document the new loop and forwarded-header behavior in the README
This commit is contained in:
2026-09-04 19:57:32 +08:00
committed by woggioni
parent f043ea4afe
commit c5b653efba
5 changed files with 32 additions and 8 deletions
+11 -1
View File
@@ -10,6 +10,7 @@ over the RSGI protocol.
- **kaya-core** — routing and HTTP request/response handling
- **kaya-rsgi** — Granian (RSGI) adapter
- **granian** — application server
- **rloop** — Rust event loop used by Granian instead of the stdlib asyncio loop
- **httpx + pwo** — test client over kaya's ASGI transport
No database, sessions, or authentication — the app is stateless.
@@ -34,6 +35,10 @@ The `/all` field order mirrors the reference site: `ip_addr`,
`remote_host`, `user_agent`, `port`, `language`, `referer`, `connection`,
`keep_alive`, `method`, `encoding`, `mime`, `charset`, `via`, `forwarded`.
The reported client IP/port honor the `Forwarded`, `X-Forwarded-For`,
`X-Forwarded-Host` and `X-Forwarded-Port` proxy headers (kaya ≥ 0.0.2);
without them the socket peer address is used.
Example:
```console
@@ -60,9 +65,14 @@ python -m venv .venv && . .venv/bin/activate
pip install --index-url https://gitea.woggioni.net/api/packages/woggioni/pypi/simple \
--extra-index-url https://pypi.org/simple \
-e .
granian --interface rsgi --host 0.0.0.0 --port 8000 pyfconfig.app:app
granian --interface rsgi --loop rloop --host 0.0.0.0 --port 8000 pyfconfig.app:app
```
The `--loop rloop` flag (or `GRANIAN_LOOP=rloop`, already set in the
Docker image) makes Granian run the app on the
[rloop](https://github.com/gi0baro/rloop) Rust event loop instead of the
stdlib asyncio loop.
### Configuration
Environment variables (see `.env.example`):