Skip to content
Documentation

Configuration

This page is published from the server repository. Edit on GitHub View source

The server is configured only through environment variables. There is no configuration file; .env.example lists the core variables for a run outside Docker, and docker-compose.yml sets them for the development stack. Variables are read when they are used, not validated at start-up: a missing secret shows as a refused request (500, 503), never as a silent default.

The development values below are public. Replace every secret before the stack leaves one machine (Deployment); generate one with openssl rand -base64 32.

Core

VariableRequiredDescriptionDevelopment value
DATABASE_URLYesPostgreSQL connection string, read by Prisma.postgresql://synthaea:synthaea_dev@localhost:5432/synthaea
BETTER_AUTH_SECRETYesSigns and encrypts console sessions (read by better-auth).dev_secret_change_in_production
NGINX_PROXY_SECRETYesShared secret nginx adds to every request as X-Proxy-Secret. Agent endpoints refuse a request without it, and refuse everything while it is unset. Set the same value on the application and the proxy.dev_nginx_secret_change_in_production
CRON_SECRETFor scheduled jobsBearer token of the /api/cron/* routes. Unset, every job call is refused.dev_cron_secret
PLATFORM_OPERATOR_USER_IDSTo create tenantsComma-separated auth_user.id values allowed to call POST /api/admin/tenants. Unset, nobody can.unset
NEXTAUTH_URLNoPublic base URL of the console. Used only as the fallback for NOTIFY_CONSOLE_URL.http://localhost:3000
NODE_ENVNodevelopment logs every Prisma query; the production image sets production.development
PORT, HOSTNAMENoWhere the Next.js server listens (default 3000 and, in the images, 0.0.0.0). The middleware calls the session route on 127.0.0.1:$PORT.3000, 0.0.0.0
NEXT_MANUAL_SIG_HANDLEIn productiontrue hands SIGINT/SIGTERM to the server's own handler, which writes pending decoy alarms (at most 5 seconds) before exiting. The production image sets it; the server logs a warning at start when it is missing.set in the runner image

docker-compose.yml also sets NEXTAUTH_SECRET, which nothing reads.

Case narratives

Any OpenAI-compatible chat-completions endpoint (assistant/llm-client.ts). Narratives are generated only when an analyst asks for one.

VariableDefaultDescription
LLM_BASE_URLhttp://localhost:11434/v1 (Ollama)Base URL; /chat/completions is appended.
LLM_MODELllama3.1Model name.
LLM_API_KEYollamaSent as a bearer token. Ollama ignores it.
LLM_PROVIDER_LABELself-hostedLabel stored with, and shown next to, each narrative.
LLM_TIMEOUT_MS30000Request timeout.

In the Compose stack, localhost is the application container itself: point LLM_BASE_URL at an address the container can reach.

Notifications

lib/notify/. Without NOTIFY_SECRET_KEY, creating a channel answers 503.

VariableDescription
NOTIFY_SECRET_KEY<keyId>:<64 hex> (key id: up to 16 of A-Za-z0-9_-). Seals channel URLs and signing secrets with AES-256-GCM. Generate with echo "k1:$(openssl rand -hex 32)".
NOTIFY_SECRET_KEY_PREVIOUSOlder keys in the same form, comma-separated, used only to open values sealed before a rotation. The delivery job re-seals them under the current key; then the old key can be removed.
NOTIFY_ALLOWED_PRIVATE_HOSTSComma-separated <tenant id>:<host> entries: hosts that tenant's webhooks may resolve to a private address (an on-premises receiver). No wildcard tenant. Loopback, link-local and cloud metadata addresses stay refused. An entry trusts a name and DNS decides the address, so prefer IP literals or names only the operator controls; /etc/hosts is not read.
NOTIFY_ALLOWED_PORTSComma-separated ports allowed besides 443.
NOTIFY_CONSOLE_URLBase URL for console links in payloads. Falls back to NEXTAUTH_URL; without either, links are null.

Telemetry archive

Off unless exactly one of LAKE_DIR or LAKE_S3_BUCKET is set; both set is an error (lib/lake-env.ts). The datalake note covers bucket permissions and the versioning requirement.

VariableDefaultDescription
LAKE_DIRWrite the archive to this directory (files written under a temporary name and renamed).
LAKE_S3_BUCKETWrite the archive to this S3-compatible bucket.
LAKE_S3_ENDPOINTAWSEndpoint of an S3-compatible server.
LAKE_S3_REGIONus-east-1
LAKE_S3_PREFIXemptyKey prefix inside the bucket.
LAKE_S3_FORCE_PATH_STYLEtrue with an endpoint, else falsetrue or false; anything else is an error.
LAKE_S3_ACCESS_KEY_ID, LAKE_S3_SECRET_ACCESS_KEYSDK default chainThe writer's credentials, both or neither.
LAKE_S3_READER_ACCESS_KEY_ID, LAKE_S3_READER_SECRET_ACCESS_KEYSDK default chainThe reader's credentials, both or neither. Never falls back to the writer's.
LAKE_WRITER_MAX_BATCHES200Queued batches one write-lake call writes.
LAKE_BACKLOG_MAX_AGE_MINUTES15Age of the oldest queued batch past which detect-lake-backlog opens a case.
LAKE_BACKLOG_MAX_BATCHES5000Queue length past which detect-lake-backlog opens a case.

Prevalence and snapshots

A numeric variable that is set but not a positive number is an error, not the default.

VariableDefaultDescription
PREVALENCE_RETENTION_DAYS180Days a sighting is kept without being seen again.
PREVALENCE_MAX_ROWS_PER_TENANT5000000Sightings kept per tenant; the oldest seen go first.
SYNTHAEA_SNAPSHOT_SIGNERunsettest signs common-set snapshots with the public test key, for labs only. Unset, no snapshot is built or served. Any other value is an error.
SNAPSHOT_MIN_HOSTS2Hosts a hash must be seen on to enter the snapshot.
SNAPSHOT_MIN_HOSTS_COVERED2Reporting hosts a tenant needs before a snapshot is built.
SNAPSHOT_FALSE_POSITIVE_RATE0.01Bloom filter false-positive rate.
SNAPSHOT_MAX_BYTES4194304Largest artifact.
SNAPSHOT_MAX_ENTRIES500000Most hashes; a tenant with more is skipped.
SNAPSHOT_MIN_ENTRY_FRACTION0.5A build with fewer entries than this fraction of the previous one, with no fall in hosts covered, is refused as truncated.

Proxy and certificates

VariableRead byDescription
NGINX_PROXY_SECRETnginx (proxy service)Substituted into nginx.conf by the nginx image's template step. Must equal the application's.
NGINX_ENVSUBST_OUTPUT_DIR, NGINX_ENVSUBST_FILTERnginx imageRender the template over /etc/nginx/nginx.conf, substituting only NGINX_* variables so nginx's own $variables stay intact.
DEV_CERT_SANSscripts/generate-dev-certs.shExtra subject alternative names for the development server certificate, such as DNS:cp.lab,IP:192.0.2.10.

Tests

VariableDescription
SYNTHAEA_ROOTParent directory of the sibling repository checkouts the contract tests read. Default: this repository's parent.
SYNTHAEA_REQUIRE_SIBLINGS1 makes a contract test fail, instead of skip, when its sibling is missing. CI sets it.

.env.test and tests/setup.ts set DATABASE_URL, BETTER_AUTH_SECRET and CRON_SECRET for the suites.

Not configurable

  • Rings (canary_0, canary_1, canary_2, prod), the silence threshold (5 minutes), the grouping window (30 minutes) and the fleet join window (24 hours) are constants in the code.
  • better-auth's trusted origins are fixed in lib/auth.ts.
  • The artifact store is always storage/ under the application's working directory.