-const getRemoteHostBaseUrl = async (remoteHost: string): Promise<string | null> => {
- let url = remoteHost;
- if (url.indexOf('://') < 0) {
- url = 'https://' + url;
- }
- const origin = new URL(url).origin;
- let baseUrl: string | null = null;
+const getClusterConfig = async (origin: string, apiClient: AxiosInstance): Promise<Config | null> => {
+ let configFromDD: Config | undefined;
+ try {
+ const dd = (await apiClient.get<any>(`${origin}/${DISCOVERY_DOC_PATH}`)).data;
+ configFromDD = {
+ baseUrl: normalizeURLPath(dd.baseUrl),
+ keepWebServiceUrl: dd.keepWebServiceUrl,
+ remoteHosts: dd.remoteHosts,
+ rootUrl: dd.rootUrl,
+ uuidPrefix: dd.uuidPrefix,
+ websocketUrl: dd.websocketUrl,
+ workbenchUrl: dd.workbenchUrl,
+ workbench2Url: dd.workbench2Url,
+ loginCluster: "",
+ vocabularyUrl: "",
+ fileViewersConfigUrl: "",
+ clusterConfig: mockClusterConfigJSON({}),
+ apiRevision: parseInt(dd.revision, 10),
+ };
+ } catch { }