Skip to content

Commit 45fbda3

Browse files
committed
Update ChangelogSnippet.astro
1 parent 3579437 commit 45fbda3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/components/ChangelogSnippet/ChangelogSnippet.astro

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,20 @@ import { searchClient } from "@algolia/client-search"
44
import ChangelogCard from "./ChangelogCard.astro"
55
import { ALGOLIA_INDEX, type ChangelogItem } from "./types"
66
import styles from "./ChangelogSnippet.module.css"
7+
import { getSecret } from "astro:env/server"
78
89
interface Props {
910
query: string
1011
}
1112
1213
const { query } = Astro.props
1314
14-
const appId = import.meta.env.PUBLIC_ALGOLIA_SEARCH_APP_ID
15-
const apiKey = import.meta.env.PUBLIC_ALGOLIA_SEARCH_PUBLIC_API_KEY
15+
const appId = getSecret("ALGOLIA_APP_ID")
16+
const apiKey = getSecret("PUBLIC_ALGOLIA_SEARCH_PUBLIC_API_KEY")
17+
18+
if (!appId || !apiKey) {
19+
throw new Error("Missing Algolia credentials")
20+
}
1621
1722
const client = searchClient(appId, apiKey)
1823

0 commit comments

Comments
 (0)