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

Function portFromOrigin

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

Source from the content-addressed store, hash-verified

2975 });
2976
2977const portFromOrigin = (origin: string): number | null => {
2978 try {
2979 const url = new URL(origin);
2980 if (!url.port) return url.protocol === "https:" ? 443 : 80;
2981 const port = Number.parseInt(url.port, 10);
2982 return Number.isInteger(port) && port > 0 ? port : null;
2983 } catch {
2984 return null;
2985 }
2986};
2987
2988const servicePortOption = () =>
2989 Options.integer("port")

Callers 2

installServiceFunction · 0.85
main.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected