UNPKG

@lunora/cli

Version:

The Lunora CLI: init, dev, deploy, codegen, run, reset, and migrate commands

20 lines (18 loc) 700 B
const LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["127.0.0.1", "::1", "[::1]", "localhost"]); const TRAILING_SLASH = /\/$/u; const resolveAdminBaseUrl = (rawUrl, logger) => { const candidate = rawUrl ?? "http://localhost:8787"; let parsed; try { parsed = new URL(candidate); } catch { logger.error(`invalid --url: ${candidate}`); return void 0; } if (!LOOPBACK_HOSTS.has(parsed.hostname) && parsed.protocol !== "https:") { logger.error(`refusing to send the admin bearer over ${parsed.protocol}// to ${parsed.hostname} — use https for non-localhost targets`); return void 0; } return candidate.replace(TRAILING_SLASH, ""); }; export { resolveAdminBaseUrl as r };