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

Function resolveOrgSlug

apps/host-cloudflare/src/config.ts:85–94  ·  view source on GitHub ↗
(value: string | undefined)

Source from the content-addressed store, hash-verified

83// segments — a colliding slug would shadow real routes (notably /api, /mcp,
84// and Cloudflare's /cdn-cgi).
85const resolveOrgSlug = (value: string | undefined): string => {
86 if (!value) return "default";
87 if (!isValidOrgSlug(value) && value !== "default") {
88 // oxlint-disable-next-line executor/no-try-catch-or-throw, executor/no-error-constructor -- boundary: a colliding org slug would shadow app routes; refuse to boot
89 throw new Error(
90 `SELF_HOSTED_ORG_SLUG ${JSON.stringify(value)} is not usable as a URL slug (2-48 chars of [a-z0-9-], not a reserved path segment like "api" or "mcp")`,
91 );
92 }
93 return value;
94};
95
96export const loadConfig = (env: CloudflareEnv): CloudflareConfig => {
97 const secretKey = env.EXECUTOR_SECRET_KEY?.trim();

Callers 1

loadConfigFunction · 0.70

Calls 1

isValidOrgSlugFunction · 0.90

Tested by

no test coverage detected