# AvParser image test service A tiny, dependency-free web service that serves a deterministic image for any id matching a configured pattern. It exists as a **target** for the app's pattern sources: point a source at one of its endpoints and let the collector generate ids. Each valid id returns a unique identicon PNG (derived from `SHA-256(id)`), so fetching the same id twice yields the same bytes — which is what makes the collector's duplicate detection observable. ## Endpoints Endpoints are declared in [`appsettings.json`](appsettings.json) under `ImgTest:Endpoints`. The defaults: | Path | Id length | Characters | Extension | | --------------- | --------- | ----------------- | --------- | | `/test1/{id}` | 6–8 | letters + digits | `.jpg` | | `/test2/{id}` | 8–12 | digits only | none | | `/test3/{id}` | 8 | hex (`0-9a-f`) | `.png` | Anything not matching a pattern (`/test1/xx`, `/test2/abcd1234`) returns `404`. `GET /` lists the endpoints; `GET /healthz` returns `ok`. Example: `GET /test1/2dfhyuj.jpg` → `200 image/png`. ### Adding an endpoint Add an object to `ImgTest:Endpoints`: ```json { "Path": "test4", "MinLength": 4, "MaxLength": 6, "Alphabet": "Custom", "Chars": "abcdef012", "Extensions": [".png"] } ``` `Alphabet` is one of `LettersLower`, `LettersUpper`, `Letters`, `Digits`, `Alphanumeric`, `HexLower`, or `Custom` (which uses `Chars`). ## Miss rate Set `ImgTest:MissRate` (0..1) to make a deterministic fraction of otherwise-valid ids answer `404`, emulating a site where most guessed ids do not exist. It is stable per id, so a run is repeatable. Override at deploy time with the `ImgTest__MissRate` environment variable. ## Run ```bash docker compose up --build ``` The container listens on `http://localhost:8080`. It speaks plain HTTP — **TLS for a public domain such as `https://imgtest.example` is terminated by your own reverse proxy**, which forwards to this container. A Caddy example: ``` imgtest.example { reverse_proxy localhost:8080 } ``` Or run it directly without Docker: ```bash dotnet run ``` > This service is intentionally **not** part of `AvParser.slnx` and is not built by `./build.ps1`. > It is a standalone support tool with its own Docker context.