spartarena/apps/api/.env.example
2026-06-14 00:47:21 +03:00

103 lines
5.5 KiB
Plaintext

# ─────────────────────────────────────────────────────────────────────────────
# SpartArena API — environment
# Copy to .env and fill in. Only DATABASE_URL is strictly required to boot the
# server; chain writes are enabled only when a signer + addresses are present.
# ─────────────────────────────────────────────────────────────────────────────
# Server
PORT=4000
HOST=0.0.0.0
NODE_ENV=development
LOG_LEVEL=info
# Comma-separated list of allowed CORS origins ("*" allows any).
CORS_ORIGIN=http://localhost:3000
# Database (PostgreSQL)
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/spartarena
# Optional Redis (reserved for future BullMQ queue; in-memory queue used if unset)
REDIS_URL=
# ── Chain ────────────────────────────────────────────────────────────────────
# Default chain is Mantle Sepolia (5003). Use 31337 for a local anvil node.
CHAIN_ID=5003
RPC_URL=https://rpc.sepolia.mantle.xyz
# Contract addresses (from packages/contracts/deployments/<chainId>.json).
# Reads require these. If unset, chain-read endpoints degrade gracefully.
NEXT_PUBLIC_AGENT_REGISTRY_ADDRESS=
NEXT_PUBLIC_TASK_ESCROW_ADDRESS=
NEXT_PUBLIC_DECISION_LEDGER_ADDRESS=
NEXT_PUBLIC_REPUTATION_ENGINE_ADDRESS=
NEXT_PUBLIC_SKILL_REGISTRY_ADDRESS=
NEXT_PUBLIC_AGENT_STAKING_ADDRESS=
# ── Signers ──────────────────────────────────────────────────────────────────
# Backend signer is the authorised DecisionLedger/TaskEscrow writer.
# If unset, execution computes proofs but does NOT write on-chain.
BACKEND_SIGNER_PRIVATE_KEY=
# Verifier signer authorised to submit reputation scores.
VERIFIER_PRIVATE_KEY=
# ── Indexer ──────────────────────────────────────────────────────────────────
# Poll interval (ms) for the chain event poller. Set 0 to disable the poller.
INDEXER_POLL_INTERVAL_MS=15000
# Number of blocks to scan per poll tick (split + backoff on over-wide ranges).
INDEXER_BLOCK_BATCH_SIZE=2000
# ── LLM providers (real) ─────────────────────────────────────────────────────
# Provider selection: ANTHROPIC_API_KEY → OpenAI → mock (only if LLM_PROVIDER=mock).
# The execution pipeline narrates decisions with a REAL model when a key is set.
ANTHROPIC_API_KEY=
# Default Claude model (latest Opus). Override if needed.
ANTHROPIC_MODEL=claude-opus-4-8
OPENAI_API_KEY=
OPENAI_MODEL=gpt-4o
# Set to "mock" ONLY for offline demo/tests (no narration, structured-only is unsupported).
LLM_PROVIDER=
# Per-request LLM timeout (ms).
LLM_TIMEOUT_MS=30000
# ── Market / chain data (real) ───────────────────────────────────────────────
# Etherscan V2 multichain key (one key, all chains; free tier 5 req/s). Used by
# AlphaSentinel to pull a wallet's real ERC-20 transfer history (action=tokentx).
ETHERSCAN_API_KEY=
# Optional CoinGecko demo key (sent as x-cg-demo-api-key). YieldStrategist reads
# real prices from CoinGecko and Mantle yields from DefiLlama (no key required).
COINGECKO_API_KEY=
# Per-request market-data timeout (ms).
MARKET_TIMEOUT_MS=15000
# ── Byreal (Solana DEX — read/quote only) ────────────────────────────────────
# Base URL for the Byreal REST API (pools/tokens lists + swap quote previews).
# No auth required for reads/quotes. Defaults to the public endpoint.
BYREAL_API_URL=https://api2.byreal.io
# Set "true" to use the deterministic offline Byreal mock (tests/demo only).
BYREAL_MOCK=
# ── Notifications (all optional — services no-op + debug-log when unset) ──────
# Lifecycle alerts (Spartan completes a Battle, Oracle Judge verifies a Battle,
# a slash is indexed) are fanned out to every configured channel in the arena
# brand voice with a War Chronicle (explorer) link. Channels with missing config
# are skipped silently; a delivery failure never breaks the lifecycle.
# GET /notifications/status reports which channels are configured (booleans only;
# the token/chat-id/webhook are never exposed).
#
# Telegram: create a bot via @BotFather for TELEGRAM_BOT_TOKEN, then set
# TELEGRAM_CHAT_ID to the target chat/channel id. Both are required for Telegram
# to activate (POST https://api.telegram.org/bot<token>/sendMessage,
# parse_mode=Markdown). Leave either blank to disable Telegram.
TELEGRAM_BOT_TOKEN=
TELEGRAM_CHAT_ID=
# Discord: an incoming webhook URL (Server Settings → Integrations → Webhooks).
# POST { content } to this URL. Leave blank to disable Discord.
DISCORD_WEBHOOK_URL=
# Security
# Require this header (x-api-key) on all mutating requests. Leave unset for local dev.
INTERNAL_API_KEY=
# Max concurrent SSE chronicle connections.
CHRONICLE_MAX_CONNECTIONS=200
RATE_LIMIT_MAX=120
RATE_LIMIT_WINDOW_MS=60000