mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
Added check-env script.
This commit is contained in:
parent
c567eddff9
commit
19ac0fce36
2 changed files with 34 additions and 1 deletions
32
scripts/check-env.js
Normal file
32
scripts/check-env.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/* 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']);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue