- Go 95.7%
- Makefile 2.5%
- Dockerfile 1.1%
- Go Template 0.7%
| .forgejo/workflows | ||
| api | ||
| cmd/dispatch-service | ||
| helm | ||
| internal | ||
| .dockerignore | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
dispatch-service
The data layer of the verzenddienst in Notificatie voor Burgers. It holds no business logic: it does
not decide who may dispatch and forwards nothing. It stores and returns what dispatch-process and
dispatch-management-process give and ask, in the database of dispatch-db (CloudNativePG).
Internal only: no Ingress or HTTPRoute points at it.
What it stores
- the senders that may dispatch, as
dispatch-processputs them in from its configuration; - the last 200 events: time, sender, chosen bezorgdienst, result and the size of the bezorgenvelop;
- the number of forwarded shipments per sender per day, apart from the capped log.
Never anything about the recipient: no functional address and no content. The verzenddienst knows the sender, never the recipient.
API
Dutch, OpenAPI 3.1, following the NL API Design Rules. The source is api/openapi.yaml;
api/openapi.json is generated from it and committed (npx -y js-yaml@4 api/openapi.yaml > api/openapi.json).
Both are served as they are at /v1/openapi.json and /v1/openapi.yaml.
Every /v1 path except the specification needs a service key (Authorization: Bearer <key>), one per
calling process. Errors are application/problem+json, every response carries API-Version.
GET /v1/afzenders,PUTandDELETE /v1/afzenders/{afzenderId}GET /v1/gebeurtenissen?aantal=1..200,POST /v1/gebeurtenissenGET /v1/statistieken→{zendingenPerAfzenderVandaag}PUT/GET/DELETE /v1/zendingen/{zendingReferentie},DELETE /v1/zendingen?aangebodenVoor=…: which afzender offered which zending, so a retour finds its way back; nothing about the recipient
Configuration
DATABASE_URL: from the Secretdispatch-db-appthat CloudNativePG createsDISPATCH_PROCESS_API_KEY,DISPATCH_MANAGEMENT_PROCESS_API_KEY: from the Secretdispatch-api-keys
Development
go test ./... # starts a throwaway Postgres with docker, or uses TEST_DATABASE_URL
golangci-lint run ./...
CI
.forgejo/workflows/ci.yml runs the tests against a Postgres service container, checks that
openapi.json matches openapi.yaml, lints the spec with Redocly and the ADR checker, lints the chart
and on main pushes the image code.digitaledienst.overheid.nl/mijn-betaaloverzicht/dispatch-service:<commit>.
Release
make release VERSION=1.2.3 # on an up-to-date main: writes helm/Chart.yaml, commits, tags v1.2.3
git push --follow-tags
The tag pipeline tags the image 1.2.3 and v1.2.3 and publishes the chart at 1.2.3 to the
Forgejo Helm registry (see the charts repository). The environments repository pins that
version.
License
EUPL-1.2, see LICENSE.