【架构优化】从 config.LoadEndpoints 中拆出端口解析 httpPortFromEnv 并合并重复的 trimURL(env()) 为 envURL
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 25/100
Línea de trabajo
Start in internal/config/endpoints.go, where LoadEndpoints repeats trimURL(env(...)) six times and inlines the AGENTFLOW_HTTP_PORT default and 1-65535 check. The refactor adds envURL and httpPortFromEnv and keeps the existing error text. Done means the internal/config tests, gofmt, and go vet pass. A linked pull request (#425) is already open, so check it before starting.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
现状问题
internal/config/endpoints.go 的 LoadEndpoints 里:
trimURL(env("AGENTFLOW_..."))这个"读环境变量并当 URL 规整"的写法重复了 6 次(AGENTFLOW_WORKER_URL、AGENTFLOW_API_URL、AGENTFLOW_CONTROL_URL、两处AGENTFLOW_PLATFORM_MCP_URL、AGENTFLOW_AGENT_TOOL_GATEWAY_URL),读起来噪音较多;AGENTFLOW_HTTP_PORT的默认值回退与 1~65535 校验内联在函数开头,与地址推导混在一起。
重构方案
- 新增包内 helper
envURL(key) = trimURL(env(key)),替换上述 6 处; - 拆出
httpPortFromEnv() (string, error),负责默认值回退与端口校验,错误文案保持invalid AGENTFLOW_HTTP_PORT %q不变; LoadEndpoints只保留按角色推导地址的逻辑。WithPrivateAgentToolGateway中env(...) == ""的判断语义不同(值为/时),保持不动。
影响范围
仅 internal/config/endpoints.go 及其测试;导出接口、返回值与错误文案不变,无行为变化。
验证方式
- 新增测试覆盖
httpPortFromEnv(默认值、合法值、非数字、越界)与envURL(空白、尾部/); - 原有
internal/config测试全部通过;gofmt、go vet ./internal/config/、go test ./internal/config/。
- Lenguaje dominante
- Go
- Estrellas
- 141
- Forks
- 28
- Merge medio
- 1 d 15 h
- PR fusionados (30 d)
- 113
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Tencent/LoopForge
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
[Bug]: 官方镜像未安装 wecom-cli,企业微信通知报「通知服务未安装 wecom-cli」Posiblemente ocupada @newexploreor la tomó hace 1 día. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Tencent/LoopForge#156 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
【架构优化】合并 gitwork/workbranch.go 中 push/pull 重复的默认提交身份注入为 withFallbackIdentityPosiblemente ocupada @fx-kurumi la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 40/100
Los mantenedores suelen responder en 1 día
-
【架构优化】从 runtime.installNPMCLI 中拆出 npm 参数拼装 npmCLIInstallArgs 与安装结果启用 activateNPMStagePosiblemente ocupada @fx-kurumi la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 30/100
Los mantenedores suelen responder en 1 día
Todos los issues de Tencent/LoopForge
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
bazel-contrib/rules_go#4784 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Уязвимые компоненты в GoAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
POSIdev-community/aictl#40 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
nebari-dev/nebari-infrastructure-core#774 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
oracle/terraform-provider-oci#2662 ·
-
[BUG]: A pre-hashed ACL password in uppercase hex fails ACL LOAD and crash-loops restarted podsAbiertobug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
valkey-io/valkey-operator#644 ·
Los mantenedores suelen responder en 3 días