Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Ibragimov committed Jan 25, 2023
1 parent 1d88d7f commit 5e314ca
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ const getEntity = (path: string, config: Config) => {
};

const hasHostHeader = Object.keys(requestHeaders).some((key) => key.toLowerCase() === 'host');
// if the host header is not set, then set it to the hostname. This is needed because the
// request will fail if the host header is not set and it is used to determine the node to
// send the request to in a multi-node cluster.
if (!hasHostHeader) {
requestHeaders.host = hostname;
}
Expand Down Expand Up @@ -193,20 +196,20 @@ export const registerAutocompleteEntitiesRoute = (deps: RouteDependencies) => {
}

const legacyConfig = await deps.proxy.readLegacyESConfig();
const configWithHeaders = {
const config = {
...legacyConfig,
request,
kibanaVersion: deps.kibanaVersion,
};

// Wait for all requests to complete, in case one of them fails return the successfull ones
const results = await Promise.allSettled([
getMappings(settings, configWithHeaders),
getAliases(settings, configWithHeaders),
getDataStreams(settings, configWithHeaders),
getLegacyTemplates(settings, configWithHeaders),
getIndexTemplates(settings, configWithHeaders),
getComponentTemplates(settings, configWithHeaders),
getMappings(settings, config),
getAliases(settings, config),
getDataStreams(settings, config),
getLegacyTemplates(settings, config),
getIndexTemplates(settings, config),
getComponentTemplates(settings, config),
]);

const [mappings, aliases, dataStreams, legacyTemplates, indexTemplates, componentTemplates] =
Expand Down

0 comments on commit 5e314ca

Please sign in to comment.