From 768bb74f9f5030b28fd30f677dfabb5fb8d5a842 Mon Sep 17 00:00:00 2001 From: Hans Ott Date: Wed, 15 Jul 2026 19:10:05 +0200 Subject: [PATCH 1/2] Use guard domains instead of runtime.aikido.dev --- library/agent/getAPIURL.ts | 18 ++----------- library/agent/realtime/getRealtimeURL.ts | 4 ++- library/agent/realtime/pollForChanges.test.ts | 26 +++++++++---------- 3 files changed, 18 insertions(+), 30 deletions(-) diff --git a/library/agent/getAPIURL.ts b/library/agent/getAPIURL.ts index ae1de5ac0..56162e6d2 100644 --- a/library/agent/getAPIURL.ts +++ b/library/agent/getAPIURL.ts @@ -1,23 +1,9 @@ -import { extractRegionFromToken } from "./extractRegionFromToken"; +import { getDefaultZenAPIURL } from "./getDefaultZenAPIURL"; export function getAPIURL() { if (process.env.AIKIDO_ENDPOINT) { return new URL(process.env.AIKIDO_ENDPOINT); } - const region = extractRegionFromToken(process.env.AIKIDO_TOKEN || ""); - - if (region === "US") { - return new URL("https://guard.us.aikido.dev"); - } - - if (region === "ME") { - return new URL("https://guard.me.aikido.dev"); - } - - if (region === "AU") { - return new URL("https://guard.au.aikido.dev"); - } - - return new URL("https://guard.aikido.dev"); + return getDefaultZenAPIURL(); } diff --git a/library/agent/realtime/getRealtimeURL.ts b/library/agent/realtime/getRealtimeURL.ts index 6f2cc465d..3d8eaa7a4 100644 --- a/library/agent/realtime/getRealtimeURL.ts +++ b/library/agent/realtime/getRealtimeURL.ts @@ -1,7 +1,9 @@ +import { getDefaultZenAPIURL } from "../getDefaultZenAPIURL"; + export function getRealtimeURL() { if (process.env.AIKIDO_REALTIME_ENDPOINT) { return new URL(process.env.AIKIDO_REALTIME_ENDPOINT); } - return new URL("https://runtime.aikido.dev"); + return getDefaultZenAPIURL(); } diff --git a/library/agent/realtime/pollForChanges.test.ts b/library/agent/realtime/pollForChanges.test.ts index abfe9be68..18f94dca6 100644 --- a/library/agent/realtime/pollForChanges.test.ts +++ b/library/agent/realtime/pollForChanges.test.ts @@ -35,7 +35,7 @@ t.test("it checks for config updates", async () => { method: params.method, }); - if (params.url.hostname.startsWith("runtime")) { + if (params.url.pathname === "/config") { return { body: JSON.stringify({ configUpdatedAt: configUpdatedAt, @@ -44,7 +44,7 @@ t.test("it checks for config updates", async () => { }; } - if (params.url.hostname.startsWith("guard")) { + if (params.url.pathname === "/api/runtime/config") { return { body: JSON.stringify({ endpoints: [], @@ -55,7 +55,7 @@ t.test("it checks for config updates", async () => { }; } - throw new Error(`Unknown hostname: ${params.url.hostname}`); + throw new Error(`Unknown path: ${params.url.pathname}`); }; }); @@ -78,7 +78,7 @@ t.test("it checks for config updates", async () => { t.same(configUpdates, []); t.same(calls, [ { - url: "https://runtime.aikido.dev/config", + url: "https://guard.aikido.dev/config", method: "GET", }, ]); @@ -95,11 +95,11 @@ t.test("it checks for config updates", async () => { ]); t.same(calls, [ { - url: "https://runtime.aikido.dev/config", + url: "https://guard.aikido.dev/config", method: "GET", }, { - url: "https://runtime.aikido.dev/config", + url: "https://guard.aikido.dev/config", method: "GET", }, { @@ -119,11 +119,11 @@ t.test("it checks for config updates", async () => { ]); t.same(calls, [ { - url: "https://runtime.aikido.dev/config", + url: "https://guard.aikido.dev/config", method: "GET", }, { - url: "https://runtime.aikido.dev/config", + url: "https://guard.aikido.dev/config", method: "GET", }, { @@ -131,7 +131,7 @@ t.test("it checks for config updates", async () => { method: "GET", }, { - url: "https://runtime.aikido.dev/config", + url: "https://guard.aikido.dev/config", method: "GET", }, ]); @@ -153,11 +153,11 @@ t.test("it checks for config updates", async () => { ]); t.same(calls, [ { - url: "https://runtime.aikido.dev/config", + url: "https://guard.aikido.dev/config", method: "GET", }, { - url: "https://runtime.aikido.dev/config", + url: "https://guard.aikido.dev/config", method: "GET", }, { @@ -165,11 +165,11 @@ t.test("it checks for config updates", async () => { method: "GET", }, { - url: "https://runtime.aikido.dev/config", + url: "https://guard.aikido.dev/config", method: "GET", }, { - url: "https://runtime.aikido.dev/config", + url: "https://guard.aikido.dev/config", method: "GET", }, { From e928d3d62ca5332b35d924c194beee7cc50c14de Mon Sep 17 00:00:00 2001 From: Hans Ott Date: Wed, 15 Jul 2026 19:12:25 +0200 Subject: [PATCH 2/2] Add missing file --- library/agent/getDefaultZenAPIURL.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 library/agent/getDefaultZenAPIURL.ts diff --git a/library/agent/getDefaultZenAPIURL.ts b/library/agent/getDefaultZenAPIURL.ts new file mode 100644 index 000000000..80b4306f8 --- /dev/null +++ b/library/agent/getDefaultZenAPIURL.ts @@ -0,0 +1,19 @@ +import { extractRegionFromToken } from "./extractRegionFromToken"; + +export function getDefaultZenAPIURL() { + const region = extractRegionFromToken(process.env.AIKIDO_TOKEN || ""); + + if (region === "US") { + return new URL("https://guard.us.aikido.dev"); + } + + if (region === "ME") { + return new URL("https://guard.me.aikido.dev"); + } + + if (region === "AU") { + return new URL("https://guard.au.aikido.dev"); + } + + return new URL("https://guard.aikido.dev"); +}