Skip to content

Commit 82eb6fd

Browse files
committed
move inkeep api key to the shared config
1 parent 7d099d4 commit 82eb6fd

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

apify-docs-theme/src/config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,17 @@ const scripts = [
341341
},
342342
];
343343

344+
const customFields = {
345+
inkeepApiKey: process.env.LOCALHOST || process.env.DEV
346+
? 'bbbb9f1001a9b66f282431a80bb743a24e2bdefb85d4f1e4' // development, works with localhost
347+
: '8af30e40009f26622237f75aab8256064c26a3063717c48a', // production, only works on apify.com (any subdomain)
348+
};
349+
344350
module.exports = {
345351
themeConfig,
346352
plugins,
347353
absoluteUrl,
348354
noIndex,
349355
scripts,
356+
customFields,
350357
};

apify-docs-theme/src/theme/SearchBar/index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ export function Link(props) {
8282

8383
export default function SearchBar({ onClick }) {
8484
const [variant, setVariant] = useState(null);
85+
const { siteConfig } = useDocusaurusContext();
86+
const { inkeepApiKey } = siteConfig.customFields;
8587

8688
useEffect(() => {
8789
const storedVariant = localStorage.getItem('search-provider');
@@ -95,10 +97,6 @@ export default function SearchBar({ onClick }) {
9597
}
9698
}, []);
9799

98-
const inkeepApiKey = process.env.LOCALHOST || process.env.DEV
99-
? 'bbbb9f1001a9b66f282431a80bb743a24e2bdefb85d4f1e4' // development, works with localhost
100-
: '8af30e40009f26622237f75aab8256064c26a3063717c48a';
101-
102100
onClick = () => {
103101
if (variant === 'kapa') {
104102
if (window.Kapa && typeof window.Kapa.open === 'function') {
@@ -117,7 +115,7 @@ export default function SearchBar({ onClick }) {
117115
if (window.Inkeep) {
118116
const config = {
119117
baseSettings: {
120-
apiKey: inkeepApiKey, // production, only works on apify.com (any subdomain)
118+
apiKey: inkeepApiKey,
121119
organizationDisplayName: 'Apify',
122120
primaryBrandColor: '#FF9013',
123121
transformSource: (source) => {
@@ -189,7 +187,7 @@ export default function SearchBar({ onClick }) {
189187

190188
modal.update({ modalSettings: { isOpen: true } });
191189
} else {
192-
console.error('Kapa.ai widget is not available.');
190+
console.error('Inkeep widget is not available.');
193191
}
194192
};
195193

docusaurus.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ module.exports = {
445445
'^/legal',
446446
'^/legal/*',
447447
],
448+
...config.customFields ?? [],
448449
},
449450
clientModules: ['./clientModule.js'],
450451
};

0 commit comments

Comments
 (0)