+const getClusterConfig = async (origin: string): Promise<Config | null> => {
+ // Try the new public config endpoint
+ try {
+ const config = (await Axios.get<ClusterConfigJSON>(`${origin}/${CLUSTER_CONFIG_PATH}`)).data;
+ return buildConfig(config);
+ } catch { }
+
+ // Fall back to discovery document
+ try {
+ const config = (await Axios.get<any>(`${origin}/${DISCOVERY_DOC_PATH}`)).data;
+ return {
+ baseUrl: normalizeURLPath(config.baseUrl),
+ keepWebServiceUrl: config.keepWebServiceUrl,
+ remoteHosts: config.remoteHosts,
+ rootUrl: config.rootUrl,
+ uuidPrefix: config.uuidPrefix,
+ websocketUrl: config.websocketUrl,
+ workbenchUrl: config.workbenchUrl,
+ workbench2Url: config.workbench2Url,
+ loginCluster: "",
+ vocabularyUrl: "",
+ fileViewersConfigUrl: "",
+ clusterConfig: mockClusterConfigJSON({})
+ };
+ } catch { }
+
+ return null;
+};
+
+const getRemoteHostConfig = async (remoteHost: string): Promise<Config | null> => {