(value: string | undefined)
| 119 | // segments — a colliding slug would shadow real routes (notably /api, /mcp, |
| 120 | // and Cloudflare's /cdn-cgi). |
| 121 | const resolveOrgSlug = (value: string | undefined): string => { |
| 122 | if (!value) return "default"; |
| 123 | if (!isValidOrgSlug(value) && value !== "default") { |
| 124 | // 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 |
| 125 | throw new Error( |
| 126 | `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")`, |
| 127 | ); |
| 128 | } |
| 129 | return value; |
| 130 | }; |
| 131 | |
| 132 | export const loadConfig = (env: CloudflareConfigEnv): CloudflareConfig => { |
| 133 | const secretKey = env.EXECUTOR_SECRET_KEY?.trim(); |
no test coverage detected