Anvil.ForgeBridge.HTTP (Anvil v0.1.1)

View Source

HTTP API client implementation for ForgeBridge.

Fetches samples from Forge via REST API. Best for microservices deployments where Anvil and Forge are separate services with independent databases.

Configuration

# config/prod.exs
config :anvil,
  forge_bridge_backend: Anvil.ForgeBridge.HTTP,
  forge_base_url: "https://forge.nsai.example.com",
  forge_api_token: System.fetch_env!("FORGE_API_TOKEN"),
  forge_timeout: 5_000

Circuit Breaker

Uses Fuse for circuit breaking to fail fast when Forge is unavailable:

  • 5 failures in 10s window → open circuit for 30s
  • Prevents cascading failures
  • Graceful degradation

API Contract

GET /api/samples/:id
Authorization: Bearer {token}

Response:
{
  "id": "uuid",
  "content": {...},
  "version_tag": "v2024-12-01",
  "metadata": {...}
}