Support standard GRANIAN_* env vars and the rloop event loop
CI / Build and push docker image (push) Successful in 2m52s

- Launcher now only injects --interface/--host/--port when the matching
  GRANIAN_* env var is unset, so every granian option (GRANIAN_LOOP,
  GRANIAN_WORKERS, GRANIAN_HTTP, GRANIAN_HOST, GRANIAN_PORT, ...) can be
  configured via granian's standard GRANIAN_* environment variables
- Add the rloop event loop as a runtime dependency so GRANIAN_LOOP=rloop
  works out of the box (previously failed with a missing 'rloop' package)
This commit is contained in:
2026-08-03 05:28:04 +00:00
parent 96cf433793
commit c7d75f6899
5 changed files with 45 additions and 9 deletions
+29
View File
@@ -52,6 +52,35 @@ Configuration is read from environment variables:
| `RBCS_DIGEST` | *(unset)* | Hash the key with this algorithm (e.g. `sha256`) |
| `RBCS_MAX_AGE` | `7d` | Value TTL (`s`/`m`/`h`/`d`) |
### Configuring Granian
The server runs on [Granian](https://github.com/emmett-framework/granian) via
its RSGI interface. Any granian option can be configured with its standard
`GRANIAN_*` environment variables (see `granian --help`), for example:
```bash
GRANIAN_LOOP=rloop GRANIAN_WORKERS=4 GRANIAN_HTTP=2 rbcs-server
```
Every granian CLI option has a matching `GRANIAN_*` variable
(`GRANIAN_LOOP`, `GRANIAN_WORKERS`, `GRANIAN_HTTP`, `GRANIAN_TASK_IMPL`,
`GRANIAN_RUNTIME_THREADS`, `GRANIAN_BLOCKING_THREADS`, `GRANIAN_LOG_LEVEL`,
`GRANIAN_METRICS`, `GRANIAN_WS`, ...).
When a `GRANIAN_*` variable and the corresponding `RBCS_*` variable are both
set, the granian one wins:
- `GRANIAN_HOST` overrides `RBCS_HOST` (default `127.0.0.1`)
- `GRANIAN_PORT` overrides `RBCS_PORT` (default `8080`)
- `GRANIAN_INTERFACE` overrides the default `rsgi` interface
The Docker image ships the `rloop` event loop, so `GRANIAN_LOOP=rloop` works
out of the box:
```bash
docker run -e GRANIAN_LOOP=rloop -e RBCS_MEMCACHE_HOST=memcached kaya-rbcs
```
The app is also a plain ASGI application, so it can be served by any ASGI
server, e.g. `daphne kaya_rbcs.app:app`.