Skip to content

Latest commit

 

History

History
55 lines (35 loc) · 1.41 KB

File metadata and controls

55 lines (35 loc) · 1.41 KB

PDF Service

A web service for generating PDF files from HTML.

The service is implemented as a single Go web service that validates JWT bearer tokens, securely processes multipart uploads and invokes WeasyPrint through a bubblewrap sandbox.

Usage

See the documentation for usage. See architecture notes for structure.

Service Deployment

The service runs as a single container exposing port 8080.

Required environment variables:

  • AUTH_AUTHORITY - OIDC authority URL (for example https://login.sandbox.bcc.no)
  • AUTH_AUDIENCE - accepted token audience (for example sandbox-api.bcc.no)

Optional environment variables:

  • PORT (default: 8080)
  • OTEL_SERVICE_NAME (when set, enables OpenTelemetry tracing/logging exporter)

All other settings use sane built-in defaults in the service code.

Local development

Use a local .env file so required settings are loaded automatically.

  1. Create local env file:
cp .env.example .env
  1. Start service with env auto-loading:
bash scripts/run-local.sh

The script reads .env, exports all values, and runs go run ./cmd/pdfservice/main.go. It also validates AUTH_AUTHORITY, AUTH_AUDIENCE, bwrap, and weasyprint before startup.

Common commands

make run
make test
make docker-build
make docker-up
make sample-pdf