Move DocSearch key to env var [ci skip]

This commit is contained in:
Ines Montani 2024-03-25 10:17:57 +01:00
parent d410d95b52
commit 1252370f69
3 changed files with 6 additions and 3 deletions

View File

@ -23,7 +23,6 @@
},
"docSearch": {
"appId": "Y1LB128RON",
"apiKey": "bb601a1daab73e2dc66faf2b79564807",
"indexName": "spacy"
},
"binderUrl": "explosion/spacy-io-binder",

View File

@ -32,6 +32,9 @@ const nextConfig = withPWA(
ignoreBuildErrors: true,
},
images: { unoptimized: true },
env: {
DOCSEARCH_API_KEY: process.env.DOCSEARCH_API_KEY
}
})
)

View File

@ -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 (
<DocSearch appId={appId} indexName={indexName} apiKey={apiKey} placeholder={placeholder} />
)