fix(api-bridge): make proxy timeout configurable via env

This commit is contained in:
jack
2026-03-12 16:59:10 +00:00
parent 1c10cfe4bc
commit d1c62420bf
2 changed files with 3 additions and 1 deletions

View File

@@ -166,6 +166,8 @@ GEMINI_CLI_USER_AGENT=google-api-nodejs-client/9.15.1
# Timeout settings
# FETCH_TIMEOUT_MS=120000
# STREAM_IDLE_TIMEOUT_MS=60000
# API bridge timeout for /v1 proxy requests (default: 30000)
# API_BRIDGE_PROXY_TIMEOUT_MS=120000
# CORS configuration (default: * allows all origins)
# CORS_ORIGINS=*

View File

@@ -2,7 +2,7 @@ import http from "node:http";
import type { IncomingMessage, ServerResponse } from "node:http";
import { getRuntimePorts } from "@/lib/runtime/ports";
const PROXY_TIMEOUT_MS = 30_000; // 30s timeout to prevent resource exhaustion
const PROXY_TIMEOUT_MS = Number(process.env.API_BRIDGE_PROXY_TIMEOUT_MS || "30000");
const OPENAI_COMPAT_PATHS = [
/^\/v1(?:\/|$)/,