Skip to content

Commit c24d009

Browse files
committed
revert back to custom plugin
1 parent 8d023a1 commit c24d009

4 files changed

Lines changed: 19 additions & 15 deletions

File tree

docusaurus.config.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -246,17 +246,7 @@ const config: Config = {
246246
{ rootDir: ".integrationBuilderCache" },
247247
],
248248
path.resolve(__dirname, "plugins", "node-polyfills"),
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-
],
249+
path.resolve(__dirname, "plugins", "env-variables-plugin"),
260250
[
261251
"@docusaurus/plugin-client-redirects",
262252
{

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,10 @@
3434
"clsx": "^1.2.1",
3535
"copy-to-clipboard": "^3.3.3",
3636
"docusaurus-openai-search": "^1.4.0",
37-
"docusaurus2-dotenv": "^1.4.0",
3837
"gray-matter": "^4.0.3",
3938
"hast-util-is-element": "^1.1.0",
4039
"joi": "^17.13.3",
4140
"lodash": "^4.17.21",
42-
"marked": "^15.0.11",
43-
"openai": "^4.97.0",
4441
"parse-numeric-range": "^1.3.0",
4542
"prism-react-renderer": "^2.3.1",
4643
"prismjs": "^1.30.0",
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// A Docusaurus plugin to provide environment variables to the client
2+
3+
module.exports = function (context, options) {
4+
return {
5+
name: "docusaurus-env-variables-plugin",
6+
injectHtmlTags() {
7+
return {
8+
headTags: [
9+
{
10+
tagName: "script",
11+
innerHTML: `window.OPENAI_API_KEY = "${process.env.OPENAI_API_KEY || ""}"`,
12+
},
13+
],
14+
};
15+
},
16+
};
17+
};

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 = process.env.OPENAI_API_KEY;
12+
const apiKey = typeof window !== "undefined" ? (window as any).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)