Move crawler and analysis configuration out of boot-only env vars and into
a DB-backed, admin-editable surface applied live without a restart.
- New `app_settings` table (migration 0026) holds one JSONB row per group;
env vars seed it on first boot, then the DB is the source of truth.
- `settings.rs` adds serializable Crawler/Analysis DTOs with env-base +
DB-overlay conversion and field-level validation; env-only/secret fields
(browser, proxy, TOR, vision API key, PHPSESSID) are never persisted.
- `GET/PUT /api/v1/admin/settings/{crawler,analysis}` (RequireAdmin,
cookie-only, CSRF-guarded): GET returns the editable DTO + a read-only
env-managed view + prompt defaults; PUT validates (422 + per-field
details), persists + audits in one tx, then gracefully respawns the
affected daemon via a Supervisor.
- AppState swaps the crawler control/resync handles and analysis enable
gate behind shared runtime cells so reloads take effect with no restart;
a boot-time spawn failure is logged rather than aborting startup.
- Make the three vision prompts and sampling temperature configurable
(defaults preserved); cookie_domain is admin-editable too.
- Frontend: tabbed /admin/settings page with grouped fieldsets, prompt
reset-to-default, env-managed read-only panel, save-&-apply confirm, and
per-field validation; typed client + ApiError.details.
- Bump version 0.79.1 -> 0.80.0.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
16 lines
709 B
SQL
16 lines
709 B
SQL
-- Runtime-editable application settings, keyed by subsystem group.
|
|
--
|
|
-- Mirrors the small key-value `crawler_state` table (0015): one row per
|
|
-- group ('crawler' | 'analysis'), the `value` JSONB holding a serialized
|
|
-- settings DTO. Env vars seed a row on first boot (when absent); after that
|
|
-- the DB row is the source of truth and the admin dashboard edits it live.
|
|
--
|
|
-- Only operationally-safe fields are stored here — host/infra and secrets
|
|
-- (chromium paths, proxy, TOR control, vision API key, cookie domain) stay
|
|
-- env-only and are never persisted.
|
|
CREATE TABLE app_settings (
|
|
key text PRIMARY KEY,
|
|
value jsonb NOT NULL,
|
|
updated_at timestamptz NOT NULL DEFAULT now()
|
|
);
|