Files
lego-instructions-manager/.env.docker.example
T
jessikitty f7c20de5ac Add owner-only logging and Brickset API call tracking
LIM configured no logging at all, so the instruction fetcher had no trail to follow. Adds a rotating file handler on the root logger plus two owner-only admin pages.

- Admin > Logs: filter by level, source and text; tracebacks kept with their error; auto-refresh, raw download, rotated-file browsing and rotate-now

- Admin > Logs > Brickset API calls: every outbound call recorded with method, params, caller, duration, result count and error, plus daily quota accounting (only getSets counts) and a comparison against getKeyUsageStats

- New owner concept (services/ownership.py): a single account, distinct from is_admin, since these pages expose other admins activity. Defaults to the first admin; flask owner show/set to change

- Services now log through module loggers; retention setting and pruning for call records

- New CLI: flask owner show/set, flask logs path/prune

- New table brickset_api_calls, created automatically at boot; LOG_* env vars, /data/logs in Docker
2026-09-27 10:42:49 +10:00

47 lines
1.7 KiB
Bash

# Copy to .env beside docker-compose.yml and fill in.
# cp .env.docker.example .env
# --- required ---------------------------------------------------------------
# Generate with: python -c "import secrets; print(secrets.token_hex(32))"
SECRET_KEY=
# Any long random string; only the db and app containers ever see it.
POSTGRES_PASSWORD=
# --- database ---------------------------------------------------------------
POSTGRES_DB=lim
POSTGRES_USER=lim
# --- app --------------------------------------------------------------------
# Host port the web UI is published on.
LIM_PORT=8000
# Backup archives to retain after a UI-initiated backup (0 = keep all).
BACKUP_KEEP=7
# Max upload size in bytes (default 50MB).
MAX_CONTENT_LENGTH=52428800
SETS_PER_PAGE=20
# --- Brickset (optional) ----------------------------------------------------
BRICKSET_API_KEY=
BRICKSET_USERNAME=
BRICKSET_PASSWORD=
# --- instruction fetcher (optional) -----------------------------------------
# Pacing (interval, delays, on/off) is set in the admin UI, not here.
# Leave the worker on unless you scale the app container past one replica or
# drive the queue yourself with `docker compose exec app flask instructions run`.
INSTRUCTION_FETCH_WORKER=1
INSTRUCTION_FETCH_TICK_SECONDS=20
# Largest instruction PDF to accept, in megabytes.
FETCH_MAX_FILE_MB=150
FETCH_TIMEOUT_SECONDS=60
# --- logging ----------------------------------------------------------------
# The admin log viewer (owner only) reads these files.
LOG_FOLDER=/data/logs
LOG_LEVEL=INFO
# Rotate at this size, keeping LOG_BACKUP_COUNT old copies.
LOG_MAX_BYTES=2097152
LOG_BACKUP_COUNT=5
# 1 to include per-request access logging (noisy).
LOG_ACCESS=0