fix: Gate E2E URL 解析 — 区分 user:pass@host:port 和 host:port
Some checks failed
Deploy API Server / build-and-unit (push) Successful in 34s
Deploy API Server / current-integration (push) Successful in 29s
Deploy API Server / backward-compat (push) Successful in 0s
Deploy API Server / m-ai-03-synthetic-e2e (push) Failing after 10s
Deploy API Server / deploy (push) Has been skipped
Some checks failed
Deploy API Server / build-and-unit (push) Successful in 34s
Deploy API Server / current-integration (push) Successful in 29s
Deploy API Server / backward-compat (push) Successful in 0s
Deploy API Server / m-ai-03-synthetic-e2e (push) Failing after 10s
Deploy API Server / deploy (push) Has been skipped
正则修正: - @([^:@]+):(\d+) — 匹配 @host:port(跳过 user:pass) - :\/\/([^:@]+):(\d+) — 兜底无认证的 host:port Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
14c87ea59f
commit
d936bf5ce3
@ -31,7 +31,11 @@ async function checkPort(host: string, port: number, label: string): Promise<voi
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function parseHostPort(url: string, defaultHost: string, defaultPort: number) {
|
async function parseHostPort(url: string, defaultHost: string, defaultPort: number) {
|
||||||
const m = url.match(/@?([^:]+):(\d+)/);
|
// DATABASE_URL: mysql://user:pass@host:port/db
|
||||||
|
// REDIS_URL: redis://host:port or redis://user:pass@host:port
|
||||||
|
// Try with @ first (authenticated), then without (no auth)
|
||||||
|
let m = url.match(/@([^:@]+):(\d+)/);
|
||||||
|
if (!m) m = url.match(/:\/\/([^:@]+):(\d+)/);
|
||||||
return { host: m?.[1] || defaultHost, port: parseInt(m?.[2] || String(defaultPort), 10) };
|
return { host: m?.[1] || defaultHost, port: parseInt(m?.[2] || String(defaultPort), 10) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user