SkateSpots/cvm-server/.env.example
SkateSpots 3a32dc2334 feat(cvm-server): load protection + type-check it in the gate
Load protection (public read-only endpoint — protects relays + this box):
- Per-pubkey sliding-window throttle and in-flight cap via inbound middleware.
  The transport can't return a JSON-RPC error, so over-budget callers are dropped
  and time out (logged).
- Global semaphore caps concurrent upstream relay queries.
- Short-TTL cache keyed by filter set, so repeated identical queries (e.g. a
  burst of get_community_stats) don't re-hit the relays.
- All tunable via CVM_RATE_* / CVM_MAX_* / CVM_QUERY_CACHE_MS (documented in
  .env.example); maps pruned by a janitor.

CI:
- cvm-server/tsconfig.json type-checks the standalone server; new
  typecheck:cvm / check:cvm scripts, with typecheck:cvm wired into npm test so
  the server can't rot unnoticed (it was excluded from tsc + eslint).
2026-09-27 11:36:20 +07:00

32 lines
1.6 KiB
Text

# ─────────────────────────────────────────────────────────────────────────────
# SkateSpots CVM Server — Environment Variables
# Copy this to .env and fill in your values
# ─────────────────────────────────────────────────────────────────────────────
# Your CVM server's Nostr private key (hex format, generated by bootstrap.sh)
# NEVER commit this to git!
CVM_SERVER_NSEC_HEX=your_64_char_hex_private_key_here
# Nostr relays to query for skate data (comma-separated)
NOSTR_RELAYS=wss://goskatespots.nostr1.com,wss://relay.ditto.pub
# CVM discovery relay — where agents find your server
CVM_RELAY=wss://relay.contextvm.org
# Log level passed to the ContextVM transport: debug | info | warn | error | silent
LOG_LEVEL=info
# How often to re-publish the discovery announcements, in ms (0 disables).
# Keeps recency-based health checks green between (re)starts.
CVM_HEARTBEAT_MS=900000
# ── Rate limiting & load protection (public, read-only endpoint) ─────────────
# Per-pubkey sliding window: max requests per window.
CVM_RATE_LIMIT=30
CVM_RATE_WINDOW_MS=300000
# Max concurrent in-flight requests per pubkey.
CVM_MAX_INFLIGHT=2
# Global cap on concurrent upstream relay queries.
CVM_MAX_UPSTREAM=8
# Short-TTL cache for identical relay queries, in ms (0 disables caching).
CVM_QUERY_CACHE_MS=30000