mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-24 18:26:20 +01:00
Added check-env script.
This commit is contained in:
parent
c567eddff9
commit
19ac0fce36
@ -11,7 +11,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "next dev -p 3000",
|
||||
"build": "npm-run-all build-db check-db build-tracker build-geo build-app",
|
||||
"build": "npm-run-all check-env build-db check-db build-tracker build-geo build-app",
|
||||
"start": "next start",
|
||||
"build-docker": "npm-run-all build-db build-tracker build-geo build-app",
|
||||
"start-docker": "npm-run-all check-db update-tracker start-server",
|
||||
@ -27,6 +27,7 @@
|
||||
"update-tracker": "node scripts/update-tracker.js",
|
||||
"update-db": "prisma migrate deploy",
|
||||
"check-db": "node scripts/check-db.js",
|
||||
"check-env": "node scripts/check-env.js",
|
||||
"copy-db-files": "node scripts/copy-db-files.js",
|
||||
"extract-messages": "formatjs extract \"{pages,components}/**/*.js\" --out-file build/messages.json",
|
||||
"merge-messages": "node scripts/merge-messages.js",
|
||||
|
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…
Reference in New Issue
Block a user