mirror of
https://github.com/kremalicious/umami.git
synced 2024-06-30 13:41:50 +02:00
33 lines
702 B
JavaScript
33 lines
702 B
JavaScript
|
/* eslint-disable no-console */
|
||
|
require('dotenv').config();
|
||
|
|
||
|
function checkMissing(vars) {
|
||
|
const missing = vars.reduce((arr, key) => {
|
||
|
if (!process.env[key]) {
|
||
|
arr.push(key);
|
||
|
}
|
||
|
}, []);
|
||
|
|
||
|
if (missing.length) {
|
||
|
console.log(`The following environment variables are not defined:`);
|
||
|
for (const item of missing) {
|
||
|
console.log(' - ', item);
|
||
|
}
|
||
|
process.exit(1);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
checkMissing(['DATABASE_URL']);
|
||
|
|
||
|
if (process.env.CLICKHOUSE_URL) {
|
||
|
checkMissing(['CA_CERT', 'CLIENT_CERT', 'CLIENT_KEY', 'KAFKA_BROKER', 'KAFKA_URL', 'REDIS_URL']);
|
||
|
}
|
||
|
|
||
|
if (process.env.CLOUD_MODE) {
|
||
|
checkMissing(['CLOUD_URL']);
|
||
|
}
|
||
|
|
||
|
if (process.env.ENABLE_BLOCKER) {
|
||
|
checkMissing(['REDIS_URL']);
|
||
|
}
|