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

Function portFromOrigin

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

Source from the content-addressed store, hash-verified

2957 });
2958
2959const portFromOrigin = (origin: string): number | null => {
2960 try {
2961 const url = new URL(origin);
2962 if (!url.port) return url.protocol === "https:" ? 443 : 80;
2963 const port = Number.parseInt(url.port, 10);
2964 return Number.isInteger(port) && port > 0 ? port : null;
2965 } catch {
2966 return null;
2967 }
2968};
2969
2970const servicePortOption = () =>
2971 Options.integer("port")

Callers 2

installServiceFunction · 0.85
main.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected