async function configFetcher()

in src/components/common/EmulatorConfigProvider.tsx [196:219]


async function configFetcher(url: string): Promise<Config> {
  const json = (await jsonFetcher(url)) as any;
  const result: Config = {
    projectId: json.projectId as string,
  };
  for (const [key, value] of Object.entries<any>(json)) {
    if (key === 'projectId') {
      continue;
    }
    const host = fixHostname(value.host as string);
    result[key as Emulator] = {
      ...value,
      host,
      hostAndPort: hostAndPort(host, value.port as number),
    };
  }

  if (result.firestore?.webSocketHost) {
    result.firestore.webSocketHost = fixHostname(
      result.firestore.webSocketHost
    );
  }
  return result;
}