File tree Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import "dotenv/config";
2
2
import type { Config } from "@docusaurus/types" ;
3
3
import type { VFile } from "vfile" ;
4
4
5
+ import { getFromSecretOrEnv } from "./utils/general" ;
5
6
import { loadConfig } from "./server/config-docs" ;
6
7
import {
7
8
getDocusaurusConfigVersionOptions ,
@@ -26,14 +27,11 @@ const latestVersion = getLatestVersion();
26
27
27
28
const config : Config = {
28
29
customFields : {
29
- inkeepConfig : ( ( ) => {
30
- const configVars = process . env . secrets ? JSON . parse ( process . env . secrets ) : process . env ;
31
- return {
32
- apiKey : configVars . INKEEP_API_KEY ,
33
- integrationId : configVars . INKEEP_INTEGRATION_ID ,
34
- organizationId : configVars . INKEEP_ORGANIZATION_ID ,
30
+ inkeepConfig : {
31
+ apiKey : getFromSecretOrEnv ( "INKEEP_API_KEY" ) ,
32
+ integrationId : getFromSecretOrEnv ( "INKEEP_INTEGRATION_ID" ) ,
33
+ organizationId : getFromSecretOrEnv ( "INKEEP_ORGANIZATION_ID" ) ,
35
34
}
36
- } ) ( ) ,
37
35
} ,
38
36
clientModules : [
39
37
"./src/styles/variables.css" ,
Original file line number Diff line number Diff line change 2
2
* Gets YouTube video metadate given video ID.
3
3
*/
4
4
5
- const YOUTUBE_API_KEY = process . env . YOUTUBE_API_KEY ;
5
+ import { getFromSecretOrEnv } from "../utils/general" ;
6
+
7
+ const YOUTUBE_API_KEY = getFromSecretOrEnv ( "YOUTUBE_API_KEY" ) ;
6
8
7
9
const REQUEST_PATH = "videos" ;
8
10
const YOUTUBE_URL = "https://www.youtube.com/watch" ;
Original file line number Diff line number Diff line change @@ -51,3 +51,8 @@ export const filterTextForXSS = (text: string): string => {
51
51
}
52
52
return text ;
53
53
} ;
54
+
55
+ export const getFromSecretOrEnv = ( name : string ) : string => {
56
+ const configVars = process . env . secrets ? JSON . parse ( process . env . secrets ) : process . env ;
57
+ return configVars [ name ]
58
+ } ;
You can’t perform that action at this time.
0 commit comments