Skip to content

Environment Variables & Security

Environment Variables & Security

Distinguishing between sensitive server-only variables and public runtime configurations is critical for secure deployment.


Interactive Configuration Generator

Interactive Environment Config Generator

# AMC-WebUI Docker 容器环境变量配置 (.env)
# 端口映射设置
WEB_PORT=8080
PORT=3001

# 密钥与安全配置
# 默认 BYOK 模式:浏览器设置中的 API Key 优先生效,以下服务端 Key 留空作为安全兜底
GEMINI_API_KEY=
SERVER_KEY_PRIORITY=false

# Gemini 上游地址
GEMINI_API_BASE=https://generativelanguage.googleapis.com
RUNTIME_API_PROXY_URL=/api/gemini

# Live API WebSocket 全代理设置
ENABLE_LIVE_WS_PROXY=true
RUNTIME_LIVE_API_BASE_URL=/api/live
LIVE_WS_IDLE_TIMEOUT_MS=300000

# 第三方 OpenAI 兼容端点反代
RUNTIME_THIRD_PARTY_PROXY_URL=/api/openai

Environment Variables Matrix

VariablePurposeScopeDefault
WEB_PORTHost exposed port for web containerHost8080
PORTNode API server listening portServer3001
GEMINI_API_KEYOptional server-managed Gemini keyServer onlyempty
LIVE_GEMINI_API_KEYDedicated server key for Live WS proxyServer onlyempty
SERVER_KEY_PRIORITYtrue=server priority; false=browser key firstServerfalse
ALLOWED_ORIGINSComma-separated CORS whitelistServerempty
ENABLE_LIVE_WS_PROXYEnable /api/live WebSocket proxyingServertrue
ENABLE_MCP_STDIOAllow running local stdio MCP processesServerfalse
THIRD_PARTY_ROUTESThird-party provider routing table JSONServer onlyempty
RUNTIME_API_PROXY_URLFrontend Gemini proxy endpointPublic runtime/api/gemini
RUNTIME_LIVE_API_BASE_URLFrontend Live WS endpointPublic runtime/api/live
RUNTIME_THIRD_PARTY_PROXY_URLThird-party proxy endpointPublic runtime/api/openai

⚠️ Security Boundary Notice

This multi-service setup is tailored for trusted self-hosted environments:

  • Standard BYOK uses browser keys. This architecture does not provide multi-tenant authentication or billing quotas for open public internet access.
  • Deploy reverse proxy authentication (Nginx, Traefik, or Cloudflare Access) when exposing endpoints publicly.