diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2022-12-15 13:03:45 +0300 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2022-12-15 13:03:45 +0300 |
commit | a3367d45cb505eb60b82120464b96ff652039eee (patch) | |
tree | 7b4d9bf55e16ab12c6d7a7a3643c671f283586a2 | |
parent | 2998611b19cf345848370416b6737ffb66935e69 (diff) | |
parent | 4b946c3679f6e7811c657bbf8eabfeaf29cdc368 (diff) |
Merge branch 'revert-2998611b' into 'main'
Revert "Merge branch 'sarahg/algolia-review-apps' into 'main'"
See merge request https://gitlab.com/gitlab-org/gitlab-docs/-/merge_requests/3372
Merged-by: Achilleas Pipinellis <axil@gitlab.com>
-rw-r--r-- | .gitlab/ci/build-and-deploy.gitlab-ci.yml | 4 | ||||
-rw-r--r-- | content/frontend/default/environment.js | 4 | ||||
-rw-r--r-- | content/frontend/search/search.js | 33 |
3 files changed, 19 insertions, 22 deletions
diff --git a/.gitlab/ci/build-and-deploy.gitlab-ci.yml b/.gitlab/ci/build-and-deploy.gitlab-ci.yml index a2a90fb4..ce41b369 100644 --- a/.gitlab/ci/build-and-deploy.gitlab-ci.yml +++ b/.gitlab/ci/build-and-deploy.gitlab-ci.yml @@ -77,10 +77,6 @@ compile_dev: - .build_base variables: ALGOLIA_SEARCH: 'false' - rules: - - if: $CI_COMMIT_REF_NAME =~ /algolia/ - variables: - ALGOLIA_SEARCH: 'true' script: - !reference [".compile-and-minify-scripts", "script"] - !reference [".gzip-scripts", "script"] diff --git a/content/frontend/default/environment.js b/content/frontend/default/environment.js index e09a83c4..8d530ded 100644 --- a/content/frontend/default/environment.js +++ b/content/frontend/default/environment.js @@ -28,7 +28,3 @@ export function isGitLabHosted() { export function isArchivesSite() { return window.location.host === GlHosts.find((x) => x.environment === 'archives').host; } - -export function isProduction() { - return window.location.host === GlHosts.find((x) => x.environment === 'production').host; -} diff --git a/content/frontend/search/search.js b/content/frontend/search/search.js index ea98f6e3..b0132354 100644 --- a/content/frontend/search/search.js +++ b/content/frontend/search/search.js @@ -1,25 +1,30 @@ -import { isProduction } from '../default/environment'; - /** - * Loads Algolia connection info. - * - * For production, we use the "gitlab" index. - * All other environments use the "gitlab_testing" index. - * Both indexes use the same credentials to connect. - * - * @see https://www.algolia.com/apps/3PNCFOU757/indices + * Functions used by both DocSearch and InstantSearch. */ -export const getAlgoliaCredentials = () => { - return { + +export const algoliaAccounts = { + production: { apiKey: 'eef4ee4af5ab6b0d76d1a2f9fc4fab58', appId: '3PNCFOU757', - index: isProduction() ? 'gitlab' : 'gitlab_testing', - }; + index: 'gitlab', + }, + testing: { + apiKey: 'eef4ee4af5ab6b0d76d1a2f9fc4fab58', + appId: '3PNCFOU757', + index: 'gitlab_testing', + }, }; /** - * Returns the site version from the docsearch:version metatag. + * 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!) */ +export const getAlgoliaCredentials = (crawler = 'production') => { + return algoliaAccounts[crawler]; +}; + export const getDocsVersion = () => { let docsVersion = 'main'; if ( |