aboutsummaryrefslogtreecommitdiff
path: root/scripts/check-env.js
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-01-24 13:09:50 +0000
committerFuwn <[email protected]>2026-01-24 13:09:50 +0000
commit396acf3bbbe00a192cb0ea0a9ccf91b1d8d2850b (patch)
treeb9df4ca6a70db45cfffbae6fdd7252e20fb8e93c /scripts/check-env.js
downloadumami-main.tar.xz
umami-main.zip
Initial commitHEADmain
Created from https://vercel.com/new
Diffstat (limited to 'scripts/check-env.js')
-rw-r--r--scripts/check-env.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/check-env.js b/scripts/check-env.js
new file mode 100644
index 0000000..79c0984
--- /dev/null
+++ b/scripts/check-env.js
@@ -0,0 +1,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']);
+}