fix(config): check base_url at load

- config: empty is fine; otherwise https with a host, http only for localhost/127.0.0.1/::1, no
  userinfo, query, fragment or whitespace; the error names base_url
- test: accepted and refused URLs
- docs: README states the rule
This commit is contained in:
tgiachi 2026-11-10 11:51:38 +01:00
commit f340078aed

View file

@ -41,7 +41,9 @@ Three listeners, each configurable:
| `web` | `127.0.0.1:8081` | public archive and unsubscribe pages (`""` disables) |
Put the `web` listener behind a reverse proxy with TLS and set `base_url` to its public URL:
the unsubscribe links in every message use it. Keep the `api` listener private.
the unsubscribe links in every message use it. It must be an `https://` URL (RFC 8058 one-click unsubscribe needs
it; `http://` is accepted only for `localhost`, `127.0.0.1` and `::1`) with a host and no credentials, query or fragment;
the daemon refuses to start otherwise. Leave it empty to turn the one-click links off. Keep the `api` listener private.
```
curl -H "Authorization: Bearer $PARSIMONY_API_TOKEN" -d '{"name":"dev","domain":"example.org","title":"Dev"}' localhost:8080/api/v1/lists