Documentation, screenshots and a couple of tweaks (#142)

* Documentation, screenshots and a couple of tweaks

* Changelog

* changelog
This commit is contained in:
Brahim Hadriche authored and GitHub committed 2023-09-10 14:44:48 -04:00
1 parent bea7fb209b
commit 0bcf361eb0
27 files changed
+642 -102

No files matched your search

+7 -1
View File
@@ -4,12 +4,18 @@ const path = require('path');
const envFile = path.join(__dirname, '../.env');
function getEnvVars() {
function getEnvVars(requiredVars = undefined) {
let envVars = process.env;
if (fs.existsSync(envFile)) {
const envConfig = dotenv.parse(fs.readFileSync(envFile));
envVars = { ...envVars, ...envConfig };
}
if (requiredVars) {
const missingVars = requiredVars.filter((key) => !envVars[key]);
if (missingVars.length) {
throw new Error(`Missing environment variables: ${missingVars.join(', ')}`);
}
}
return envVars;
}