- Go 97.3%
- Makefile 1.5%
- Dockerfile 0.8%
- Go Template 0.4%
| .forgejo/workflows | ||
| api | ||
| cmd/source-organization-service | ||
| helm | ||
| internal | ||
| .dockerignore | ||
| CHANGELOG.md | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
source-organization-service
The data layer of the bronorganisatie in Notificatie voor Burgers (blauwe-knop layering: process, service, db).
It stores and returns what source-organization-process gives and asks for, and makes no decisions:
no validation of message types, no rules about when an ontvangstbevestiging is allowed.
Five operations are conditional because only the database can make them atomic: the first retrieval moment, the first ontvangstbevestiging and the first retour moment are set only while still empty, the next volgnummer per adreskaart is handed out in one statement, and an adreskaartlevering replaces what is kept for its BSN only when its version is higher.
The burgers the adresregister delivered (POST /v1/burgers) are kept with BSN, name and adreskaart under an
unguessable id of the service's own; a bericht refers to that burgerId. Searching by name is a POST
(/v1/burgers/zoeken), so neither a name nor a BSN ever lands in a URL.
A bericht also keeps the verzenddienst's zendingReferentie (PUT /v1/berichten/{id}/zending-referentie),
so a retour, which carries only that reference, finds its bericht (PUT /v1/retouren/{zendingReferentie}).
A zending the verzenddienst refused at offer never got a reference; its bericht gets its retour moment by
id (PUT /v1/berichten/{id}/retour-op).
API
Contract: api/openapi.yaml (OpenAPI 3.1, Dutch, NL API Design Rules), with the generated
api/openapi.json committed next to it. Both are served at /v1/openapi.yaml and
/v1/openapi.json; CI checks that the JSON matches the YAML. Regenerate after a change:
npx -y js-yaml@4 api/openapi.yaml > api/openapi.json
Internal only (Kubernetes Service source-organization-service), never routed. Every call except the
specification needs the caller's service key as Authorization: Bearer <key>.
Configuration
DATABASE_URL: from the app Secret that CloudNativePG creates forsource-organization-db(uri)SOURCE_ORGANIZATION_PROCESS_API_KEY: the service key ofsource-organization-process, from the Secretsource-organization-api-keysLISTEN_ADDRESS: defaults to:8080
Development
The tests run against a real Postgres, because the SQL is what this service is about: TEST_DATABASE_URL
(each test package creates a database of its own on that server) or, without it, a throwaway container
via the local docker.
go test ./...
golangci-lint run ./...
docker build --target production -t code.digitaledienst.overheid.nl/mijn-betaaloverzicht/source-organization-service:dev .
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.