|
| 1 | +# ============================================================================= |
| 2 | +# HARBOR — ENVIRONMENT VARIABLE REFERENCE |
| 3 | +# Keys read by core/config/config.ts (validateGlobalConfig + |
| 4 | +# resolveStoreTypeConfig). Copy to your deploy env or local .env file. |
| 5 | +# |
| 6 | +# Convention: |
| 7 | +# - Uncommented lines = defaults applied when the var is absent. |
| 8 | +# - Commented lines = conditional / optional; set only when needed. |
| 9 | +# - "required" means the process exits at startup if the var is absent |
| 10 | +# and the relevant backend type is active. |
| 11 | +# |
| 12 | +# ── Quick index (everything validateGlobalConfig + backends may read) ──────── |
| 13 | +# Always parsed (defaults shown inline below where uncommented): |
| 14 | +# MCP_HOST MCP_PORT MCP_TRANSPORT MCP_TOKEN? |
| 15 | +# SERVICES_DIR |
| 16 | +# SESSION_IDLE_TTL_MS SESSION_SWEEP_INTERVAL_MS |
| 17 | +# AUTH_TOKEN_CACHE_TTL_MS TOKEN_CACHE_TYPE IDEMPOTENCY_TYPE |
| 18 | +# SANDBOX_MEMORY_MB SANDBOX_EXECUTE_TIMEOUT_MS SANDBOX_SEARCH_TIMEOUT_MS |
| 19 | +# SANDBOX_MAX_API_CALLS SANDBOX_MAX_CONCURRENT_CALLS |
| 20 | +# LOG_LEVEL SERVICE_NAME MCP_AGENT_NAME ENVIRONMENT ENABLE_AUDIT |
| 21 | +# Conditional — TOKEN_CACHE_TYPE: |
| 22 | +# memcache → TOKEN_CACHE_MEMCACHE_HOST PORT (+ optional TIMEOUT_MS) |
| 23 | +# couchbase → TOKEN_CACHE_CB_HOST PORT BUCKET USERNAME PASSWORD (+ optional TIMEOUT_MS) |
| 24 | +# Conditional — IDEMPOTENCY_TYPE: |
| 25 | +# memcache → IDEMPOTENCY_MEMCACHE_HOST PORT (+ optional TIMEOUT_MS) |
| 26 | +# couchbase → IDEMPOTENCY_CB_HOST PORT BUCKET USERNAME PASSWORD (+ optional TIMEOUT_MS) |
| 27 | +# ============================================================================= |
| 28 | + |
| 29 | +# ── MCP server ──────────────────────────────────────────────────────────────── |
| 30 | +MCP_HOST=127.0.0.1 |
| 31 | +MCP_PORT=3333 |
| 32 | +# http | stdio |
| 33 | +MCP_TRANSPORT=http |
| 34 | +# Required when MCP_TRANSPORT=stdio — static bearer for the stdio client connection |
| 35 | +# MCP_TOKEN= |
| 36 | + |
| 37 | +# ── Services directory ──────────────────────────────────────────────────────── |
| 38 | +# Absolute or relative path to the directory containing per-service subdirectories. |
| 39 | +# Each subdirectory must contain a config.json. Defaults to ./services when unset. |
| 40 | +# In Docker the image sets this to /app/services automatically. |
| 41 | +# SERVICES_DIR=./services |
| 42 | + |
| 43 | +# ── Session (HTTP transport only) ───────────────────────────────────────────── |
| 44 | +# Idle MCP session eviction threshold (ms). Default: 1 hour. |
| 45 | +SESSION_IDLE_TTL_MS=3600000 |
| 46 | +# How often the idle-session sweeper runs (ms). Default: 5 min. |
| 47 | +SESSION_SWEEP_INTERVAL_MS=300000 |
| 48 | + |
| 49 | +# ── Auth — token cache TTL ──────────────────────────────────────────────────── |
| 50 | +# Upper bound on how long a validated token stays cached. Actual TTL per entry |
| 51 | +# = min(token's own expires_in, AUTH_TOKEN_CACHE_TTL_MS). Default: 5 min. |
| 52 | +AUTH_TOKEN_CACHE_TTL_MS=300000 |
| 53 | + |
| 54 | +# ── Token cache backend (SYSTEM-LEVEL — shared by every service, no per-service override) |
| 55 | +# One backend is active for the entire gateway process. |
| 56 | +# Valid values: in-memory | memcache | couchbase |
| 57 | +TOKEN_CACHE_TYPE=in-memory |
| 58 | + |
| 59 | +# ── TOKEN_CACHE_TYPE=memcache ───────────────────────────────────────────────── |
| 60 | +# Prefix: TOKEN_CACHE_MEMCACHE_ |
| 61 | +# Use when multiple gateway pods share a Memcached cluster for token lookups. |
| 62 | +# |
| 63 | +# TOKEN_CACHE_MEMCACHE_HOST=memcache.svc.cluster.local # required |
| 64 | +# TOKEN_CACHE_MEMCACHE_PORT=11211 # required |
| 65 | +# TOKEN_CACHE_MEMCACHE_TIMEOUT_MS=2000 # optional (default: 2000) |
| 66 | + |
| 67 | +# ── TOKEN_CACHE_TYPE=couchbase ──────────────────────────────────────────────── |
| 68 | +# Prefix: TOKEN_CACHE_CB_ (host, port, bucket, username, password). |
| 69 | +# Token cache and idempotency use separate env prefixes so each can target a different cluster. |
| 70 | +# Recommended bucket name: mcp-token-cache (bucket TTL ≈ 300 s to match token TTL). |
| 71 | +# |
| 72 | +# TOKEN_CACHE_CB_HOST=cb-cluster-0.cb-cluster.couchbase.svc.cluster.local # required |
| 73 | +# TOKEN_CACHE_CB_PORT=8091 # required (REST/KV port per your deployment) |
| 74 | +# TOKEN_CACHE_CB_BUCKET=mcp-token-cache # required — create bucket in Couchbase first |
| 75 | +# TOKEN_CACHE_CB_USERNAME= # required — Vault: TOKEN_CACHE_CB_USERNAME |
| 76 | +# TOKEN_CACHE_CB_PASSWORD= # required — Vault: TOKEN_CACHE_CB_PASSWORD |
| 77 | +# TOKEN_CACHE_CB_TIMEOUT_MS=3000 # optional (default: 3000) |
| 78 | + |
| 79 | +# ── Sandbox (SYSTEM-LEVEL defaults — per-service config.json sandbox block may override) |
| 80 | +SANDBOX_MEMORY_MB=64 # V8 isolate memory cap per run (MB) |
| 81 | +SANDBOX_EXECUTE_TIMEOUT_MS=8000 # Wall-clock cap for api_execute sandbox (ms; includes awaits) |
| 82 | +SANDBOX_SEARCH_TIMEOUT_MS=3000 # Wall-clock cap for search_code / discover_skills (ms) |
| 83 | +SANDBOX_MAX_API_CALLS=50 # Max api.request() calls per sandbox run |
| 84 | +SANDBOX_MAX_CONCURRENT_CALLS=5 # Max concurrent in-flight requests per run |
| 85 | + |
| 86 | +# ── Idempotency (SYSTEM-LEVEL default — services may override type + TTL in config.json) |
| 87 | +# Default is noop (no deduplication). For multi-pod deployments use memcache or couchbase. |
| 88 | +# Connection fields (host/port/bucket/credentials) are env-only; per-service config.json |
| 89 | +# may only change the type and idempotencyKeyTtlMs. |
| 90 | +# Valid values: noop | in-memory | memcache | couchbase |
| 91 | +IDEMPOTENCY_TYPE=noop |
| 92 | + |
| 93 | +# ── IDEMPOTENCY_TYPE=memcache ───────────────────────────────────────────────── |
| 94 | +# Prefix: IDEMPOTENCY_MEMCACHE_ |
| 95 | +# Use when multiple gateway pods share a Memcached cluster for request deduplication. |
| 96 | +# Token cache may use a different Memcached cluster via TOKEN_CACHE_MEMCACHE_*. |
| 97 | +# |
| 98 | +# IDEMPOTENCY_MEMCACHE_HOST=memcache.svc.cluster.local # required |
| 99 | +# IDEMPOTENCY_MEMCACHE_PORT=11211 # required |
| 100 | +# IDEMPOTENCY_MEMCACHE_TIMEOUT_MS=2000 # optional (default: 2000) |
| 101 | + |
| 102 | +# ── IDEMPOTENCY_TYPE=couchbase ──────────────────────────────────────────────── |
| 103 | +# Prefix: IDEMPOTENCY_CB_ |
| 104 | +# Recommended bucket name: mcp-idempotency (bucket TTL ≈ 86400 s = 1 day). |
| 105 | +# |
| 106 | +# IDEMPOTENCY_CB_HOST=cb-cluster-0.cb-cluster.couchbase.svc.cluster.local # required |
| 107 | +# IDEMPOTENCY_CB_PORT=8091 # required |
| 108 | +# IDEMPOTENCY_CB_BUCKET=mcp-idempotency # required — create bucket in Couchbase first |
| 109 | +# IDEMPOTENCY_CB_USERNAME= # required — Vault: IDEMPOTENCY_CB_USERNAME |
| 110 | +# IDEMPOTENCY_CB_PASSWORD= # required — Vault: IDEMPOTENCY_CB_PASSWORD |
| 111 | +# IDEMPOTENCY_CB_TIMEOUT_MS=3000 # optional (default: 3000) |
| 112 | + |
| 113 | +# ── Observability ───────────────────────────────────────────────────────────── |
| 114 | +# fatal | error | warn | info | debug | trace |
| 115 | +LOG_LEVEL=info |
| 116 | +SERVICE_NAME=harbor-gateway |
| 117 | +# Sent as X-Request-Source header to all downstream API calls. Default: mcp-agent. |
| 118 | +MCP_AGENT_NAME=mcp-agent |
| 119 | +# dev | staging | staging-secondary | canary | prod |
| 120 | +# Non-prod environments include caller file:line in logs (pino-caller). |
| 121 | +ENVIRONMENT=dev |
| 122 | +# Set true in production to log every api_execute call for compliance/audit trails. |
| 123 | +ENABLE_AUDIT=false |
| 124 | + |
| 125 | +# ── OAuth 2.1 / RFC 9728 Protected Resource Metadata (optional) ────────────── |
| 126 | +# Set HARBOR_RESOURCE_URI to enable the OAuth 2.1 discovery flow. |
| 127 | +# When set, Harbor advertises a /.well-known/oauth-protected-resource document |
| 128 | +# and includes a WWW-Authenticate header on 401 responses so MCP clients can |
| 129 | +# discover where to obtain a token. Clients that already carry a token are |
| 130 | +# completely unaffected. |
| 131 | +# |
| 132 | +# HARBOR_RESOURCE_URI=https://harbor.example.com # required to enable OAuth 2.1 mode |
| 133 | +# HARBOR_AUTH_SERVERS=https://auth.example.com # comma-separated list of AS URIs |
| 134 | +# HARBOR_SCOPES_SUPPORTED=api:read,api:write # optional: advertised scopes |
| 135 | + |
| 136 | +# ── Per-service config.json ──────────────────────────────────────────────────── |
| 137 | +# Connection and strategy options for each service live in services/<name>/config.json, |
| 138 | +# not in env vars. See docs/configuration.md for the full per-service reference and the |
| 139 | +# idempotency merge semantics over the IDEMPOTENCY_* defaults above. |
0 commit comments