Jelajahi Sumber

bypass jwt secret env validation for migration scripts

Pouria Ezzati 1 tahun lalu
induk
melakukan
1a41cd9708
1 mengubah file dengan 8 tambahan dan 0 penghapusan
  1. 8 0
      knexfile.js

+ 8 - 0
knexfile.js

@@ -1,3 +1,11 @@
+// this configuration is for migrations only
+// and since jwt secret is not required, it's set to a placehodler string to bypass env validation
+if (process.env.NODE_ENV !== "development" && process.env.NODE_ENV !== "production") {
+  if (!process.env.JWT_SECRET) {
+    process.env.JWT_SECRET = "securekey";
+  }
+}
+
 const env = require("./server/env");
 
 const isSQLite = env.DB_CLIENT === "sqlite3" || env.DB_CLIENT === "better-sqlite3";