Add support for ENV variables

This commit is contained in:
Serafeim Chatzopoulos 2022-12-12 09:35:53 +02:00
parent caa6f7d196
commit 17bd13446b
4 changed files with 29 additions and 2 deletions

2
.env Normal file
View File

@ -0,0 +1,2 @@
URL="http://snf-23385.ok-kno.grnetcloud.net"
BASE_URL="/"

View File

@ -6,13 +6,23 @@ const darkCodeTheme = require('prism-react-renderer/themes/dracula');
const math = require('remark-math');
const katex = require('rehype-katex');
const { filterItems } = require('./sidebar-utils');
const dotenv = require('dotenv');
// load env variables (see .env file)
const env = dotenv.config();
if (env.error) {
throw env.error;
}
console.info("ENV VARIABLES:");
console.info(env.parsed);
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'OpenAIRE Documentation',
tagline: 'Open Access Infrastructure for Research in Europe',
url: 'http://snf-23385.ok-kno.grnetcloud.net',
baseUrl: '/', // serve the website at route
url: process.env.URL,
baseUrl: process.env.BASE_URL, // serve the website at route
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',

14
package-lock.json generated
View File

@ -12,6 +12,7 @@
"@docusaurus/preset-classic": "^2.2.0",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.1",
"dotenv": "^16.0.3",
"hast-util-is-element": "^1.1.0",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
@ -5422,6 +5423,14 @@
"node": ">=8"
}
},
"node_modules/dotenv": {
"version": "16.0.3",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
"integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==",
"engines": {
"node": ">=12"
}
},
"node_modules/duplexer": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz",
@ -16363,6 +16372,11 @@
}
}
},
"dotenv": {
"version": "16.0.3",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
"integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ=="
},
"duplexer": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz",

View File

@ -18,6 +18,7 @@
"@docusaurus/preset-classic": "^2.2.0",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.1",
"dotenv": "^16.0.3",
"hast-util-is-element": "^1.1.0",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",