Skip to main content
All configuration is via environment variables, loaded with python-dotenv. config.py reads the local .env in the pipeline directory; shell variables take precedence.

Required variables

Microsoft Graph (Outlook fetch)

The app registration needs application permissions (not delegated) on Microsoft Graph:
  • Mail.Read
  • Mail.ReadWrite (to mark messages as read)
If any of these are missing, the fetcher fails on first call with ValueError: AZURE_TENANT_ID is required.

PostgreSQL (Cloud SQL)

Cloud SQL Connector tunnels via Google’s IAM auth — no public IP needed on the database. The service account must have at least cloudsql.instances.connect and cloudsql.client IAM roles on the instance. If any are missing, the writer fails when the first session is opened with a Cloud SQL Connector error.

Optional variables

Encryption key

If you change this in the pipeline, you must also change it in the form’s CryptoJS config — the two must match exactly, byte-for-byte. The key length must remain 16 bytes (AES-128). To rotate the key:
  1. Generate a new 16-character ASCII string
  2. Update MW_AES_KEY in the pipeline env
  3. Update the form’s embedded key constant
  4. Re-export the configured HTML for each vessel
  5. Distribute the new HTML to the fleet
  6. Existing emails encrypted with the old key will fail decryption — keep both keys for the transition window if needed

Other constants

These live in src/config.py as module constants (not env vars). Override by editing the file.

Markers

The parser looks for these strings to find the encrypted block. If the form’s markers change, update both sides.

Subject regex

Captures vessel name, report type, date (DD.MM.YYYY). Subjects that don’t match are filtered out by the fetcher.

Report type mapping

Maps the human-readable subject text to the canonical type stored in metaweave_report.report_type. Add new entries here when the form ships a new report type.

Sample .env

Encode the service account JSON with:
(or cat service-account.json | base64 | tr -d '\n')

How config is loaded

What’s not configurable

The pipeline does not support:
  • Multiple Outlook mailboxes per run (one mailbox per invocation)
  • Multiple databases per run
  • Different schema per environment (use different POSTGRES_DB)
  • Different table prefix (the metaweave_ prefix is hardcoded)
For multi-tenant deployments, run multiple instances with different env files and orchestrate via your scheduler.

See also