From 1252370f6984f977de000bd0da74508c144e20d5 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Mon, 25 Mar 2024 10:17:57 +0100 Subject: [PATCH] Move DocSearch key to env var [ci skip] --- website/meta/site.json | 1 - website/next.config.mjs | 3 +++ website/src/components/search.js | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/website/meta/site.json b/website/meta/site.json index f1d318071..55fe60ad3 100644 --- a/website/meta/site.json +++ b/website/meta/site.json @@ -23,7 +23,6 @@ }, "docSearch": { "appId": "Y1LB128RON", - "apiKey": "bb601a1daab73e2dc66faf2b79564807", "indexName": "spacy" }, "binderUrl": "explosion/spacy-io-binder", diff --git a/website/next.config.mjs b/website/next.config.mjs index df3b1d01d..5e2f8f8c3 100644 --- a/website/next.config.mjs +++ b/website/next.config.mjs @@ -32,6 +32,9 @@ const nextConfig = withPWA( ignoreBuildErrors: true, }, images: { unoptimized: true }, + env: { + DOCSEARCH_API_KEY: process.env.DOCSEARCH_API_KEY + } }) ) diff --git a/website/src/components/search.js b/website/src/components/search.js index f80d9cd9f..3211b53c0 100644 --- a/website/src/components/search.js +++ b/website/src/components/search.js @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react' +import React from 'react' import PropTypes from 'prop-types' import { DocSearch } from '@docsearch/react' import '@docsearch/css' @@ -6,7 +6,8 @@ import '@docsearch/css' import siteMetadata from '../../meta/site.json' export default function Search({ placeholder = 'Search docs' }) { - const { apiKey, indexName, appId } = siteMetadata.docSearch + const apiKey = process.env.DOCSEARCH_API_KEY + const { indexName, appId } = siteMetadata.docSearch return ( )