Skip to content

Commit

Permalink
Change root key fetching logic for remote environments
Browse files Browse the repository at this point in the history
  • Loading branch information
rvanasa committed Jan 16, 2024
1 parent d0b4ccd commit ce40a19
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/ui/src/candid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ declare var d3: any;

const names: Record<number,string> = {};

function is_local(agent: HttpAgent) {
function isKnownMainnet(agent: HttpAgent) {
// @ts-ignore
const hostname = agent._host.hostname;
return hostname === '127.0.0.1' || hostname.endsWith('localhost');
return hostname.endsWith('.icp0.io') || hostname.endsWith('.ic0.app');
}

export let authClient: AuthClient | undefined;

const agent = new HttpAgent();
if (is_local(agent)) {
if (!isKnownMainnet(agent)) {
agent.fetchRootKey();
}

Expand Down

0 comments on commit ce40a19

Please sign in to comment.