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
51 lines
1.7 KiB
Bash
51 lines
1.7 KiB
Bash
# Flask Configuration
|
|
FLASK_APP=run.py
|
|
FLASK_ENV=development
|
|
SECRET_KEY=your-secret-key-change-this-in-production
|
|
|
|
# Database Configuration
|
|
DATABASE_URL=sqlite:///lego_instructions.db
|
|
# For PostgreSQL: postgresql://username:password@localhost/lego_instructions
|
|
|
|
# Brickset API Configuration
|
|
BRICKSET_API_KEY=your-brickset-api-key-here
|
|
BRICKSET_USERNAME=your-brickset-username
|
|
BRICKSET_PASSWORD=your-brickset-password
|
|
|
|
# Upload Configuration
|
|
UPLOAD_FOLDER=app/static/uploads
|
|
MAX_CONTENT_LENGTH=52428800 # 50MB max file size
|
|
ALLOWED_EXTENSIONS=pdf,png,jpg,jpeg,gif
|
|
|
|
# Backup Configuration
|
|
# Where backup archives are written. Keep this OUTSIDE app/static/uploads.
|
|
# Docker: point this at a mounted volume, e.g. /data/backups
|
|
BACKUP_FOLDER=backups
|
|
# Archives to retain after a backup started from the admin UI (0 = keep all)
|
|
BACKUP_KEEP=5
|
|
|
|
# Application Configuration
|
|
SETS_PER_PAGE=20
|
|
|
|
# --- Automatic instruction fetcher -----------------------------------------
|
|
# Pacing lives in the admin UI (Admin > Instruction Fetcher). These are the
|
|
# process-level knobs.
|
|
# Set to 0 to disable the background worker thread and drive the queue from
|
|
# Task Scheduler / cron with `flask instructions run` instead.
|
|
INSTRUCTION_FETCH_WORKER=1
|
|
# How often the worker checks whether the interval has elapsed, in seconds.
|
|
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=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
|