INNER CODE UNIT · TypeScript

runtimeTag

caura-ai/caura · clients/typescript/src/index.ts:22

function runtimeTag(): string {
  const node = (globalThis as { process?: { versions?: { node?: string } } }).process?.versions?.node;
  return node ? ` (node/${node.split(".")[0]})` : "";
}

function isLoopbackHost(hostname: string): boolean {
  const host = hostname.toLowerCase().replace(/^\[(.*)\]$/, "$1");
  return (
    host === "localhost" ||
    host.endsWith(".localhost") ||
    host === "::1" ||
    /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(host)
  );
}

function envAllowsInsecureHttp(): boolean {
  const env = (globalThis as { process?: { env?: Record<string, string | undefined> } }).process?.env;
  return ["true", "1"].includes(env?.CAURA_ALLOW_INSECURE_HTTP ?? "");

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…