From d272a83cfc5d4a92aa3655f6a6c806aa40a34c70 Mon Sep 17 00:00:00 2001 From: VictorMaznyuk Date: Mon, 12 Oct 2026 05:01:06 +0200 Subject: [PATCH] fix(deploy): pass WEKNORA_OUTBOUND_DIAL_TIMEOUT through to the app container (#4157) #4122 made the outbound (SSRF-safe) dial timeout configurable through WEKNORA_OUTBOUND_DIAL_TIMEOUT (internal/config/config.go, applyNetworkEnvOverrides), but the variable is not listed in services.app.environment, so in a Docker Compose deployment there is no way to set it: a value in the host .env never reaches the container, and slow serverless endpoints keep failing at the 5s default. Pass it through with an empty default. applyNetworkEnvOverrides only overrides the timeout when the trimmed value is non-empty and parses as a positive duration, so an unset variable keeps the 5s default unchanged. Also document it in .env.example next to the other outbound settings. Co-authored-by: Victor Maznyuk Co-authored-by: Claude Opus 5.5 --- .env.example | 4 ++++ docker-compose.yml | 2 ++ 2 files changed, 6 insertions(+) diff --git a/.env.example b/.env.example index cd0d6fe8..1248e3c3 100644 --- a/.env.example +++ b/.env.example @@ -778,6 +778,10 @@ LANGFUSE_HOST=http://langfuse-web:3000 # 不再通过解析结果匹配 CIDR。离线或内网部署建议开启,并把模型、向量库、对象存储等地址全部列入白名单。 # SSRF_DNS_WHITELIST_ONLY=false # +# 出站拨号超时(Go duration,默认 5s):模型、连接器等外部端点在此时间内连不上即失败。 +# 冷启动较慢的 serverless 端点可调大,例如 15s。 +# WEKNORA_OUTBOUND_DIAL_TIMEOUT=5s +# # ===== 向量库地址的 SSRF 校验 ===== # 通过 API 创建/测试向量库连接时,地址会经过 SSRF 校验。docker-compose 内置服务 # (qdrant, milvus, weaviate, doris-fe, doris-be, searxng, minio)已通过 SSRF_WHITELIST_EXTRA 默认放行。 diff --git a/docker-compose.yml b/docker-compose.yml index a46fb252..cfd23f4a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -99,6 +99,8 @@ services: # Docker 沙箱默认关闭:本机 docker.sock 等同宿主机 root。 # 系统管理员也可在「设置 → 系统设置」打开(立即生效)。未落库时读本变量。 - WEKNORA_SANDBOX_DOCKER_ENABLED=${WEKNORA_SANDBOX_DOCKER_ENABLED:-false} + # 出站拨号超时(Go duration,默认 5s):模型、连接器等外部端点在此时间内连不上即失败。留空使用默认值。 + - WEKNORA_OUTBOUND_DIAL_TIMEOUT=${WEKNORA_OUTBOUND_DIAL_TIMEOUT:-} # gin 信任的代理 CIDR(逗号分隔);显式设为空字符串则禁用代理信任。 # 默认信任 loopback + 私网段(容器网络内 nginx 已覆盖) # - WEKNORA_TRUSTED_PROXIES=${WEKNORA_TRUSTED_PROXIES:-}