programme-pulse-chat/.env.example
DJP b70d148b94 Productionise Programme Pulse
Backend
- Routes moved under /api/, JWT bearer auth via @before_request
- DEV_AUTH_BYPASS escape hatch for local dev
- In-memory chat history and report state replaced with Postgres tables
  (preferences, chat_messages, reports, feedback_events) keyed on user
- SQLAlchemy 2.x + Alembic migrations run on container start
- Graceful Airtable failure handling — bad creds no longer 500 the API
- Per-user data isolation via g.user_email from validated token

Frontend
- React + Vite + TypeScript SPA at /programme-pulse/
- MSAL.js (PKCE, sessionStorage, ID token to backend)
- VITE_DEV_AUTH_BYPASS mirrors backend bypass for local dev
- Streaming chat via fetch ReadableStream + SSE parsing
- Charts via chart.js, markdown via react-markdown + remark-gfm
- Full UI parity with the original templates/index.html

Deploy (optical-dev split-build pattern)
- Dockerfile + docker-compose.yml (name: programme-pulse pinned;
  app + Postgres; 127.0.0.1 binding only)
- deploy/apache-programme-pulse.conf.tmpl with flushpackets=on for SSE
- deploy/deploy.sh mirrors OSOP — port auto-pick (5051..5099),
  apache conf render, frontend build in throwaway node container,
  rsync to /var/www/html/programme-pulse, /api/health poll

Tests
- 49 passing; new tests for DB-backed preferences and JWT auth helpers
- SQLite-backed test fixture in tests/conftest.py

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 11:08:28 -04:00

34 lines
1.1 KiB
Text

# --- Anthropic ---
ANTHROPIC_API_KEY=sk-ant-...
# --- Airtable: tasks (Master tracker) ---
PULSE_AIRTABLE_API_KEY=pat...
PULSE_AIRTABLE_BASE_ID=appXXXXXXXXXXXXXX
PULSE_AIRTABLE_TABLE_ID=tblXXXXXXXXXXXXXX
# --- Airtable: resource bookings ---
# Falls back to PULSE_AIRTABLE_API_KEY if PULSE_RESOURCE_API_KEY is unset
PULSE_RESOURCE_API_KEY=pat...
PULSE_RESOURCE_BASE_ID=appXXXXXXXXXXXXXX
PULSE_RESOURCE_TABLE_ID=tblXXXXXXXXXXXXXX
# --- Azure AD (Microsoft SSO) ---
# Single-page application registration in your Azure tenant.
# Add redirect URIs for both prod and local dev.
AZURE_TENANT_ID=
AZURE_CLIENT_ID=
# Comma-separated list (e.g. oliver.agency). Empty = allow any tenant user.
AUTH_ALLOWED_DOMAINS=oliver.agency
# Local dev only — skips token validation, sets g.user_email = 'dev@oliver.agency'
DEV_AUTH_BYPASS=false
# --- Postgres ---
# Inside the compose network the host is `db`; override for local-against-host runs.
DATABASE_URL=postgresql+psycopg://pulse:pulse@db:5432/pulse
POSTGRES_USER=pulse
POSTGRES_PASSWORD=pulse
POSTGRES_DB=pulse
# --- Server ---
# Host port the deploy script picks; the container always listens on 5051.
PROGRAMME_PULSE_PORT=5051