Welcome to mirror list, hosted at ThFree Co, Russian Federation.

search.js « search « frontend « content - gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7000359d7216c9896049315e0da1c0454ef950b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
 * Functions used by both DocSearch and InstantSearch.
 */

export const algoliaAccounts = {
  production: {
    apiKey: '89b85ffae982a7f1adeeed4a90bb0ab1',
    appId: '3PNCFOU757',
    index: 'gitlab',
  },
  testing: {
    apiKey: '181a86cec565045e1851b68cd9b4a7d3',
    appId: '3PNCFOU757',
    index: 'gitlab_testing',
  },
};

/**
 * Loads Algolia connection info for a given Crawler.
 *
 * Set the crawler default to 'testing' in order to use
 * the gitlab_testing index. (Don't forget to change it back!)
 *
 * @TODO Set this back to 'production' before merge!
 */
export const getAlgoliaCredentials = (crawler = 'testing') => {
  return algoliaAccounts[crawler];
};

export const getDocsVersion = () => {
  let docsVersion = 'main';
  if (document.querySelector('meta[name="docsearch:version"]').content.length > 0) {
    docsVersion = document.querySelector('meta[name="docsearch:version"]').content;
  }
  return docsVersion;
};