diff --git a/library/agent/getAPIURL.test.ts b/library/agent/getAPIURL.test.ts index 7b56e1d55..cc6608af9 100644 --- a/library/agent/getAPIURL.test.ts +++ b/library/agent/getAPIURL.test.ts @@ -45,3 +45,8 @@ t.test("should respect AIKIDO_ENDPOINT if set", async (t) => { process.env.AIKIDO_ENDPOINT = "https://custom-endpoint.example.com"; t.equal(getAPIURL().href, "https://custom-endpoint.example.com/"); }); + +t.test("should return AU for new format token with AU region", async (t) => { + process.env.AIKIDO_TOKEN = "AIK_RUNTIME_123_456_AU_randomstring"; + t.equal(getAPIURL().href, "https://guard.au.aikido.dev/"); +}); diff --git a/library/agent/getAPIURL.ts b/library/agent/getAPIURL.ts index bc7f28b11..ae1de5ac0 100644 --- a/library/agent/getAPIURL.ts +++ b/library/agent/getAPIURL.ts @@ -15,5 +15,9 @@ export function getAPIURL() { 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"); }