2026-05-14 05:32:23 -04:00
|
|
|
# Control Center - Environment Variables
|
|
|
|
|
# ======================================
|
|
|
|
|
|
|
|
|
|
# ── Backend Variables ───────────────────────────────────────────────────
|
|
|
|
|
# Server configuration
|
|
|
|
|
PORT=8080
|
|
|
|
|
CORS_ORIGIN=http://localhost:3000
|
|
|
|
|
LOG_LEVEL=info
|
|
|
|
|
ENVIRONMENT=development
|
|
|
|
|
|
|
|
|
|
# Database connection (PostgreSQL DSN)
|
|
|
|
|
# Format: postgresql://user:password@host:port/database?sslmode=disable
|
|
|
|
|
DATABASE_URL=postgresql://controlcenter:controlcenter@localhost:5432/controlcenter?sslmode=disable
|
|
|
|
|
|
CUB-200: implement WebSocket gateway client with v3 protocol
Replace REST poller with WebSocket client as primary gateway connection:
- wsclient.go: WebSocket client with v3 handshake (connect.challenge →
connect → hello-ok), frame routing (req/res/event), JSON-RPC Send(),
auto-reconnect with exponential backoff (1s → 30s max)
- sync.go: Initial sync via agents.list + sessions.list RPCs, merge
session runtime state into AgentCardData, broadcast fleet.update
- events.go: Real-time event handlers for sessions.changed, presence,
and agent.config — DB update first, then SSE broadcast
- client.go: REST poller retained as fallback (WS is primary)
- config.go: Add GATEWAY_WS_URL and OPENCLAW_GATEWAY_TOKEN env vars
- main.go: Wire WS client as primary, REST as fallback
- .env.example: Document new WS config vars
Fallback: If WS connection fails, seeded demo data + REST polling
remain available.
2026-05-20 11:33:17 +00:00
|
|
|
# Gateway (OpenClaw) connection — WebSocket (primary)
|
|
|
|
|
# WebSocket URL for real-time OpenClaw gateway v3 protocol
|
|
|
|
|
GATEWAY_WS_URL=ws://localhost:18789/
|
|
|
|
|
# Auth token for the OpenClaw gateway (operator scope)
|
|
|
|
|
OPENCLAW_GATEWAY_TOKEN=
|
|
|
|
|
|
|
|
|
|
# Gateway (OpenClaw) connection — REST (fallback)
|
|
|
|
|
# URL to the OpenClaw gateway API for polling agent states (used only if WS fails)
|
2026-05-14 05:32:23 -04:00
|
|
|
GATEWAY_URL=http://localhost:18789/api/agents
|
|
|
|
|
# Polling interval for agent state updates
|
|
|
|
|
GATEWAY_POLL_INTERVAL=5s
|
|
|
|
|
|
|
|
|
|
# ── Frontend Variables (via Vite) ───────────────────────────────────────
|
|
|
|
|
# The Vite config exposes these as import.meta.env.VITE_*
|
|
|
|
|
# Set via environment variable when building: VITE_API_URL
|
|
|
|
|
# VITE_API_URL=http://localhost:8080
|
|
|
|
|
|
|
|
|
|
# ── Docker Compose Specific ─────────────────────────────────────────────
|
|
|
|
|
# When using docker-compose, these are set in the services section
|
|
|
|
|
# See docker-compose.yml for service-specific environment variables
|
|
|
|
|
|
|
|
|
|
# ── Database Configuration ─────────────────────────────────────────────
|
|
|
|
|
# Set in the db service environment section of docker-compose.yml
|
|
|
|
|
# POSTGRES_USER=controlcenter
|
|
|
|
|
# POSTGRES_PASSWORD=controlcenter
|
|
|
|
|
# POSTGRES_DB=controlcenter
|
|
|
|
|
|
|
|
|
|
# ── Development Notes ───────────────────────────────────────────────────
|
|
|
|
|
# For local development without Docker:
|
|
|
|
|
# 1. Start PostgreSQL locally
|
|
|
|
|
# 2. Run: go run ./cmd/server/main.go
|
|
|
|
|
# 3. Run: npm run dev in frontend/
|
|
|
|
|
#
|
|
|
|
|
# For Docker deployment:
|
|
|
|
|
# 1. Copy .env.example to .env (backend only)
|
|
|
|
|
# 2. Run: docker compose up -d
|
|
|
|
|
# 3. Access frontend at http://localhost:3000
|