blob: 79c0984ddce508c58273ad5908d808c70dbf132f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
/* eslint-disable no-console */
import 'dotenv/config';
function checkMissing(vars) {
const missing = vars.reduce((arr, key) => {
if (!process.env[key]) {
arr.push(key);
}
return arr;
}, []);
if (missing.length) {
console.log(`The following environment variables are not defined:`);
for (const item of missing) {
console.log(' - ', item);
}
process.exit(1);
}
}
if (!process.env.SKIP_DB_CHECK && !process.env.DATABASE_TYPE) {
checkMissing(['DATABASE_URL']);
}
if (process.env.CLOUD_URL) {
checkMissing(['CLOUD_URL', 'CLICKHOUSE_URL', 'REDIS_URL']);
}
|