summaryrefslogtreecommitdiff
path: root/middlewares/sessions.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--middlewares/sessions.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/middlewares/sessions.js b/middlewares/sessions.js
index 8697ae0..901c262 100644
--- a/middlewares/sessions.js
+++ b/middlewares/sessions.js
@@ -1,9 +1,12 @@
import expressSession from "express-session";
-import sqlite from "better-sqlite3";
+import Database from "better-sqlite3";
import sqliteStore from "better-sqlite3-session-store";
const SqliteStore = sqliteStore(expressSession);
-const db = new sqlite("sessions.db", process.env.NODE_ENV === "production" ? null : { verbose: console.log });
+const db = new Database(
+ process.env.NODE_ENV === "test" ? "testsessions.db" : "sessions.db",
+ process.env.NODE_ENV === "development" ? { verbose: console.log } : null
+);
const secret = process.env.SESSION_SECRET || "secret";
const session = expressSession({
cookie: {