mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-20 13:07:57 +09:00
## Summary - Clickable footer opens a modal showing all service health, versions, deploy times, and PR links - Progressive disclosure: basic info for everyone, blue-green encoder details for admins - New aggregated `/api/health/system-status` endpoint (single fetch instead of 4 separate calls) - CI captures git SHA and PR info, passes to frontend and backend builds ## Changes - **Backend**: New `/api/health/system-status` endpoint with optional admin auth for blue-green Firestore config - **Backend**: Build metadata env vars (COMMIT_SHA, PR_NUMBER, PR_TITLE, STARTUP_TIME) in version module - **Frontend**: New `SystemStatusModal` component with service cards and expandable blue-green section - **Frontend**: Footer version line is now clickable to open the modal - **Frontend**: Build metadata env vars passed through next.config.mjs - **CI**: Both frontend and backend deploy jobs capture and pass git SHA + PR info ## Testing - [x] 3 unit tests for system-status endpoint (public, offline, admin blue-green) - [x] TypeScript compilation clean (no new errors) - [x] CodeRabbit CLI reviewed @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
"""
|
|
Version module for karaoke-gen backend.
|
|
|
|
Separated to avoid circular imports.
|
|
"""
|
|
import os
|
|
|
|
|
|
def get_version() -> str:
|
|
"""Get package version from environment variable, installed package, or fallback."""
|
|
# First check environment variable (set during deployment)
|
|
env_version = os.environ.get("KARAOKE_GEN_VERSION")
|
|
if env_version:
|
|
return env_version
|
|
|
|
# Try to get from installed package metadata
|
|
try:
|
|
from importlib.metadata import version
|
|
return version("karaoke-gen")
|
|
except Exception:
|
|
pass
|
|
|
|
# Fallback if package not installed (e.g., during development)
|
|
return "dev"
|
|
|
|
|
|
VERSION = get_version()
|
|
|
|
# Build metadata — set by CI during deployment
|
|
COMMIT_SHA = os.environ.get("COMMIT_SHA", "")
|
|
PR_NUMBER = os.environ.get("PR_NUMBER", "")
|
|
PR_TITLE = os.environ.get("PR_TITLE", "")
|
|
STARTUP_TIME = None # Set on first import
|
|
|
|
|
|
def _get_startup_time() -> str:
|
|
"""Record when the backend process started (proxy for deploy time)."""
|
|
from datetime import datetime, timezone
|
|
return datetime.now(timezone.utc).isoformat()
|
|
|
|
|
|
STARTUP_TIME = _get_startup_time()
|