fleetops/src/env.js
david kiania ff5945a85d feat: FleetOps analytics SPA (Caddy) — initial scaffold
Fleet operations analytics (fuel · utilisation · distance · driver behaviour),
sibling to FleetNow. Self-contained src/index.html (inline CSS/JS + Chart.js CDN)
reusing FleetNow's warm-dark ops palette + header shell for a familiar look.

Reads dashboard_api /analytics/* (fleet-summary, utilisation, driver-behaviour,
fuel, filters). Panels: KPI strip, distance/idle daily-trend chart, per-vehicle
table, driver leaderboard, fuel (data-gated).

Served by Caddy on :80 (Traefik terminates TLS). Per-env API base injected at
runtime via Caddy `templates` -> /env.js ({{env "API_BASE"}}); falls back to the
staging API. Dockerfile runs `caddy validate` at build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 13:00:31 +03:00

5 lines
339 B
JavaScript

// Runtime config — Caddy's `templates` directive replaces {{env "API_BASE"}}
// with the API_BASE env var at request time (see Caddyfile). If unset (e.g. a
// plain `caddy file-server` without templates), it stays a literal and index.html
// falls back to the staging API. Never cached.
window.FLEETOPS_API_BASE = "{{env "API_BASE"}}";