Skip to content

Commit 18cc8e0

Browse files
committed
Update the env variable plugin
1 parent b3aa453 commit 18cc8e0

4 files changed

Lines changed: 15 additions & 21 deletions

File tree

docusaurus.config.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,17 @@ const config: Config = {
246246
{ rootDir: ".integrationBuilderCache" },
247247
],
248248
path.resolve(__dirname, "plugins", "node-polyfills"),
249-
path.resolve(__dirname, "plugins", "env-variables-plugin"),
249+
[
250+
"docusaurus2-dotenv",
251+
{
252+
path: "./.env", // The path to your environment variables.
253+
safe: false, // If false ignore safe-mode, if true load './.env.example', if a string load that file as the sample
254+
systemvars: false, // Set to true if you would rather load all system variables as well (useful for CI purposes)
255+
silent: false, // If true, all warnings will be suppressed
256+
expand: false, // Allows your variables to be "expanded" for reusability within your .env file
257+
defaults: false, // Adds support for dotenv-defaults. If set to true, uses ./.env.defaults
258+
},
259+
],
250260
[
251261
"@docusaurus/plugin-client-redirects",
252262
{

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@
3333
"classnames": "^2.5.1",
3434
"clsx": "^1.2.1",
3535
"copy-to-clipboard": "^3.3.3",
36-
"docusaurus-openai-search": "^1.2.0",
36+
"docusaurus-openai-search": "^1.2.3",
37+
"docusaurus2-dotenv": "^1.4.0",
3738
"gray-matter": "^4.0.3",
3839
"hast-util-is-element": "^1.1.0",
3940
"joi": "^17.13.3",
4041
"lodash": "^4.17.21",
4142
"marked": "^15.0.11",
42-
"openai": "^4.96.0",
43+
"openai": "^4.97.0",
4344
"parse-numeric-range": "^1.3.0",
4445
"prism-react-renderer": "^2.3.1",
4546
"prismjs": "^1.30.0",

plugins/env-variables-plugin/index.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/theme/SearchBar/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default function SearchBar() {
99
},
1010
} = useDocusaurusContext();
1111

12-
const apiKey = typeof window !== "undefined" ? (window as any).OPENAI_API_KEY || "" : "";
12+
const apiKey = process.env.OPENAI_API_KEY;
1313

1414
const systemPrompt =
1515
"You are a helpful Web3Auth expert assistant. Your goal is to provide detailed, accurate information about Web3Auth's authentication solutions, SDKs, and integrations to developers.\n\n" +

0 commit comments

Comments
 (0)