- Rebrand from Vigilio Desto → Vigo, the Watcher of Trentuna - Updated hugo.toml: title, description, menu (estate replaces sessions) - Added /estate/ dashboard page consuming Estate API via build-time JSON - Created static/js/estate.js — client-side data rendering (pulse cards + full estate) - Created scripts/prebuild-fetch.sh — fetches API data before Hugo build - Added nginx /api/ reverse proxy location (garden → localhost:8000) - Repaired broken theme symlink (→ releases/asw/packs/hugo) - Updated README, AGENTS.md, .gitignore for Hugo build artifacts - Site builds clean: 206 pages, 79ms
45 lines
No EOL
1.2 KiB
Bash
Executable file
45 lines
No EOL
1.2 KiB
Bash
Executable file
#!/bin/bash
|
|
# prebuild-fetch.sh — Fetch Estate API data at build time and save as static JSON
|
|
#
|
|
# Called before `hugo` to populate static/data/ with API snapshots.
|
|
# The estate.js client reads from /data/*.json as the primary source.
|
|
#
|
|
# Usage: bash scripts/prebuild-fetch.sh
|
|
|
|
set -euo pipefail
|
|
|
|
DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
DATA_DIR="${DIR}/static/data"
|
|
API_HOST="${API_HOST:-http://127.0.0.1:8000}"
|
|
API_KEY="trentuna-estate-key-2026"
|
|
|
|
mkdir -p "$DATA_DIR"
|
|
|
|
ENDPOINTS=(
|
|
"summary"
|
|
"health"
|
|
"disk"
|
|
"events?limit=10"
|
|
"repos"
|
|
"providers"
|
|
"builds"
|
|
"trends?limit=5"
|
|
"state"
|
|
)
|
|
|
|
echo "→ Fetching Estate API data for garden build…"
|
|
|
|
for ep in "${ENDPOINTS[@]}"; do
|
|
filename="$(echo "$ep" | sed 's/[?&=/]/-/g' | sed 's/--*/-/g' | sed 's/^-//')"
|
|
url="${API_HOST}/${ep}"
|
|
|
|
if json=$(curl -sf -H "X-API-Key: ${API_KEY}" "$url" 2>/dev/null); then
|
|
echo "$json" > "${DATA_DIR}/${filename}.json"
|
|
echo " ✓ ${ep} → ${filename}.json ($(echo "$json" | wc -c) bytes)"
|
|
else
|
|
echo " ✗ ${ep} — API unreachable"
|
|
echo '{"error":true,"message":"API unavailable at build time"}' > "${DATA_DIR}/${filename}.json"
|
|
fi
|
|
done
|
|
|
|
echo "→ Done. ${#ENDPOINTS[@]} endpoints cached." |