Files
Hello/server/deploy/poorbird.env.example
T
Thomas KarnerandClaude Opus 5 3344a9e9b1 Harden config: no credentials in code (REVIEW SEC-001, SEC-006)
SEC-006: database_url had a working default carrying a real username and
password. Removed. Absence is now reported by 'poorbird check' as a problem
(exit 1) and raised by db.py with a message that names the variable and the
example file, instead of SQLAlchemy's "Could not parse URL from string ''"
three frames down.

SEC-001: enroll_secret stays environment-only and keeps its empty default so
the Phase 1 commands still run on a fresh clone. The device endpoints will
refuse to serve without it when they land.

Both fields now reject unedited placeholders (CHANGE_ME and friends), so a
copied .example cannot boot as though it were configured.

Tests: 12 -> 17. New cases cover the absent default, the readable failure,
and placeholder rejection for both fields.

Note: 6 files unrelated to this change are not clean under 'ruff format'
(the repo is wrapped at 88, pyproject sets line-length 100). Left alone to
keep this diff reviewable.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-21 12:11:34 +02:00

48 lines
2.2 KiB
Bash

# poorBird configuration.
#
# Install to /etc/poorbird/poorbird.env, owned by root:poorbird, mode 0640.
# systemd loads it via EnvironmentFile. This same file becomes a compose .env
# unchanged if containers ever happen (TODO.md Phase 1.2).
#
# Note: systemd's EnvironmentFile does NOT do shell quoting or expansion.
# Write VALUES literally, with no surrounding quotes.
# --- database ---------------------------------------------------------------
# Loopback TCP with scram-sha-256, deliberately not a Unix socket.
# Required: the app has no built-in default and refuses to start without it.
# The literal CHANGE_ME below is rejected at startup, so you cannot copy this
# file and forget to edit it.
POORBIRD_DATABASE_URL=postgresql+psycopg://poorbird:CHANGE_ME@127.0.0.1:5432/poorbird
# --- http -------------------------------------------------------------------
# Bind to loopback only; Caddy is the only thing that talks to it.
# Caddy itself takes :8080 for the camera and :443 for humans, so uvicorn sits
# behind on 8090. See deploy/Caddyfile.
POORBIRD_API_HOST=127.0.0.1
POORBIRD_API_PORT=8090
# --- storage ----------------------------------------------------------------
# Read by the app AND referenced by the Caddyfile: the auth-checked image
# handoff needs both to agree on this path (SPEC 3.3).
POORBIRD_IMAGE_ROOT=/srv/poorbird/images
POORBIRD_THUMB_ROOT=/srv/poorbird/thumbs
POORBIRD_STATE_DIR=/var/lib/poorbird
# --- devices ----------------------------------------------------------------
# Shared bootstrap secret the firmware presents in X-Enroll-Secret.
# Generate with: openssl rand -hex 32
#
# WARNING (firmware/API.md): this value is compiled into the firmware image as
# the last-resort recovery path for a camera that cannot be reached over USB.
# Rotating it here WITHOUT shipping new firmware removes that escape hatch.
POORBIRD_ENROLL_SECRET=
# --- worker -----------------------------------------------------------------
POORBIRD_WORKER_POLL_INTERVAL_S=2
POORBIRD_JOB_MAX_ATTEMPTS=3
# --- logging ----------------------------------------------------------------
POORBIRD_LOG_LEVEL=INFO
# text for journalctl by eye, json once you are shipping logs somewhere.
POORBIRD_LOG_FORMAT=text