trails/infrastructure/.env.example
Ullrich Schäfer e2bf3ddb94
fix(infra): refuse compose up when production secrets are missing
infrastructure/docker-compose.yml had \`\${VAR:-default}\` fallbacks for
JWT_SECRET, SESSION_SECRET, and POSTGRES_PASSWORD that silently
substituted known-weak values (\`change-me-in-production\`, \`trails\`)
when the env wasn't set. A misconfigured prod deploy would happily come
up with these defaults — JWT/session forgery + a guessable Postgres
password.

Switched the four critical substitutions to \`\${VAR:?message}\` so
\`docker compose up\` fails loud instead. Mirrors the existing pattern
already used for BROUTER_URL/BROUTER_AUTH_TOKEN and (in staging) for
JWT_SECRET/SESSION_SECRET.

Sites fixed:
- journal:   DATABASE_URL (POSTGRES_PASSWORD), JWT_SECRET, SESSION_SECRET
- planner:   DATABASE_URL (POSTGRES_PASSWORD)
- postgres:  POSTGRES_PASSWORD (container itself)
- exporter:  DATA_SOURCE_NAME (POSTGRES_PASSWORD)
- staging:   both DATABASE_URLs

Production already provides all three via SOPS-encrypted
secrets.app.env, so this is a defense-in-depth change with no behavior
change on a properly-configured deploy.

Updated infrastructure/.env.example to make SESSION_SECRET explicit
(was missing) and call out the trio as required.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 22:59:09 +02:00

30 lines
1.4 KiB
Text

# trails.cool infrastructure environment variables
# Copy to .env and fill in values
DOMAIN=trails.cool
# These three are REQUIRED for compose up — the production
# docker-compose.yml refuses to start without them. Generate strong
# random values; never reuse anything from this example file.
POSTGRES_PASSWORD=change-me
JWT_SECRET=change-me
SESSION_SECRET=change-me
S3_ACCESS_KEY=
S3_SECRET_KEY=
# Overpass upstream failover. Comma-separated list tried in order;
# first 2xx response wins. Falls back to the single-URL OVERPASS_URL
# if this is unset, and to a built-in default list if neither is set.
# OVERPASS_URLS=https://lz4.overpass-api.de/api/interpreter,https://overpass-api.de/api/interpreter
# Demo-activity-bot. Only enable in prod. When true, the journal worker
# bootstraps a demo user and generates public demo routes + activities
# every 90 min. Retention is in days (default 14).
# DEMO_BOT_ENABLED=true
# DEMO_BOT_RETENTION_DAYS=14
# DEMO_BOT_REGION={"bbox":[13.25,52.45,13.55,52.60]}
#
# Override the default Bruno persona (identity + generated copy) via
# either an inline JSON blob or a file path. See docs/demo-persona.md
# for the schema.
# DEMO_BOT_PERSONA=file:/etc/trails-cool/persona.json
# DEMO_BOT_PERSONA={"username":"hamish","displayName":"Hamish","bio":"...","locales":["en"],"content":{"names":{"en":["...","...","..."]},"descriptions":{"en":["...","...","..."]}}}