MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / portFromOrigin

Function portFromOrigin

apps/cli/src/main.ts:2829–2838  ·  view source on GitHub ↗
(origin: string)

Source from the content-addressed store, hash-verified

2827 });
2828
2829const portFromOrigin = (origin: string): number | null => {
2830 try {
2831 const url = new URL(origin);
2832 if (!url.port) return url.protocol === "https:" ? 443 : 80;
2833 const port = Number.parseInt(url.port, 10);
2834 return Number.isInteger(port) && port > 0 ? port : null;
2835 } catch {
2836 return null;
2837 }
2838};
2839
2840const servicePortOption = () =>
2841 Options.integer("port")

Callers 2

installServiceFunction · 0.85
main.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected