MCPcopy Create free account
hub / github.com/github/gh-aw / extractPortFromURL

Function extractPortFromURL

actions/setup/js/codex_harness.cjs:263–272  ·  view source on GitHub ↗

* Extract numeric port from a URL string. * @param {string} urlString * @returns {number|null}

(urlString)

Source from the content-addressed store, hash-verified

261 * @returns {number|null}
262 */
263function extractPortFromURL(urlString) {
264 if (!urlString || typeof urlString !== "string") return null;
265 try {
266 const parsed = new URL(urlString);
267 if (!parsed.port) return null;
268 return Number(parsed.port);
269 } catch {
270 return null;
271 }
272}
273
274/**
275 * Read Codex openai-proxy base_url from config.toml content.

Calls

no outgoing calls

Tested by

no test coverage detected