Configuration
Every runtime value is read from the environment. .env.example is the authoritative list; the groups below mirror it.
Application
| Var | Default | Purpose |
APP_HOST | 0.0.0.0 | Bind interface for the api. Keep 0.0.0.0 inside Docker. |
APP_PORT | 8080 | Listen port for the api. |
LOG_LEVEL | info | One of trace, debug, info, warn, error. |
Database
| Var | Default | Purpose |
DATABASE_URL | none (required) | Postgres connection URL. Example: postgresql://dmarc_reporter:PASSWORD@db:5432/dmarc_reporter. |
Security
| Var | Default | Purpose |
ENCRYPTION_KEY | none (required) | 32 bytes, Base64 encoded. Encrypts data_sources.encrypted_password and data_sources.oauth_refresh_token_enc. Changing the value invalidates every ciphertext; there is no online rotation path. |
AUTH_PROVIDERS | hosting-profile default (Bunyip enabled) | Comma-separated priority list of authentication providers this process answers through. |
TRUSTED_PROXY_CIDRS | empty (trust nothing) | Comma-separated CIDRs and bare IPs whose X-Forwarded-For, X-Real-IP, and X-IPCountry headers the api believes. Unset means the socket peer is the only non-forgeable input; the rate limiter and geolocation attribution key off it. |
Job scheduling
Cron fields are sec min hour day-of-month month day-of-week year (7 fields).
| Var | Default | Purpose |
SCHEDULE_INCOMING_QUEUE | 0 0 */12 * * * * | How often to poll data sources and process new emails. |
SCHEDULE_FAILED_QUEUE | 0 0 */12 * * * * | How often to reattempt emails sitting in the failed folder. |
RETRY_COUNT | 5 | Attempts per email inside one incoming-queue run before it moves to the failed folder. |
MAX_EMAILS_PER_RUN | 100 | Soft cap on emails processed per incoming-queue run, per source. |
MAX_EMAILS_PER_RUN_LIMIT | 2000 | Hard ceiling. MAX_EMAILS_PER_RUN is clamped to this value. |
SHUTDOWN_TIMEOUT | 300 | Seconds the api waits for in-flight jobs to finish during a graceful shutdown. |
Geolocation
| Var | Default | Purpose |
IP2LOCATION_DB_PATH | unset | Absolute path to an IP2Location LITE DB11 binary file. Unset disables geolocation enrichment entirely; the job does not run and no dataset is required. |
Alert SMTP
| Var | Default | Purpose |
SMTP_HOST | smtp.example.com | Outbound relay for alert emails. |
SMTP_PORT | 587 | |
SMTP_SECURITY | starttls | One of starttls, tls, none. |
SMTP_USERNAME | alerts@example.com | |
SMTP_PASSWORD | none | |
SMTP_FROM_ADDRESS | DMARC Reporter <alerts@example.com> | RFC 5321 address shown in the From header. |
ADMIN_EMAIL | admin@example.com | Recipient for alert emails. |
TRANSACTIONAL_OUTBOX_DIR | tmp/outbox | Directory the api writes alert emails to instead of sending, when the recipient domain is non-routable (example.com, .invalid, .localhost, .test). |
Alert thresholds
| Var | Default | Purpose |
ALERT_AUTH_FAILURE_RATE | 10.0 | Percentage. Triggers the HighAuthFailureRate alert when exceeded. |
ALERT_VOLUME_SPIKE_RATE | 50.0 | Percentage. Triggers the EmailVolumeSpike alert when traffic grows by more than this over the previous period. |
Weekly report
| Var | Default | Purpose |
WEEKLY_REPORT_ENABLED | false | Opt in to a weekly summary email. |
SCHEDULE_WEEKLY_REPORT | 0 0 8 * * 1 * | Mondays at 08:00 by default. Only read when enabled. |
Frontend and reverse proxy
| Var | Default | Purpose |
DOMAIN | dmarc.example.com | Public hostname served by Caddy. |
FRONTEND_URL | https://dmarc.example.com | Public URL of the SPA. Used as the post-OIDC return redirect. |
CORS_ORIGIN | https://dmarc.example.com | Allowed browser origin for the api’s CORS middleware. Falls back to FRONTEND_URL when unset. |
API_PUBLIC_URL | https://drillmark-api.example.com | Public URL of the api. Used to derive OAUTH_REDIRECT_URI when unset. |
OAUTH_REDIRECT_URI | derived from API_PUBLIC_URL | Explicit callback URL; set only to override the derived value. |
OIDC and Bunyip (required)
The api refuses to boot without the five OIDC values set.
| Var | Default | Purpose |
OIDC_ISSUER | none (required) | URL of the mokosh-server OIDC OP. |
OIDC_AUDIENCE | none (required) | Expected aud claim on access tokens. |
OIDC_JWKS_URL | derived from issuer | Signing key endpoint. |
OIDC_CLIENT_ID | none (required) | UUID of Drillmark’s oauth_clients row at mokosh-server. |
OIDC_SCOPES | openid email offline_access mokosh:read | Scopes requested on the authorize URL. |
MOKOSH_API_URL | none | Mokosh REST surface for org sync (/v1/orgs). Usually the same host as OIDC_ISSUER. |
BUNYIP_URL | none | Origin of the Bunyip hub. Surfaced to the SPA as the post-logout target and the “manage your account” link. No trailing slash. |
BUNYIP_STATUS_CLIENT_ID | unset | Machine credential client id for Bunyip’s provider-status aggregator. |
BUNYIP_STATUS_CLIENT_SECRET | unset | Paired secret. Set both to enable the machine-credential path; either unset falls back to RequireAdminAccess alone. |
Tenancy and invites
| Var | Default | Purpose |
DRILLMARK_DEFAULT_TENANT_ID | first tenant row | Tenant UUID new JIT-provisioned users land in. |
INVITE_EXPIRY_DAYS | 7 | How long an invite link stays valid. |
FEATURE_LOCAL_USER_MANAGEMENT | false | When off, the local user / org / invitation endpoints return 410 Gone. Flip on only once per-RP tenant claims through Bunyip are in place. |