@@ -14,23 +14,25 @@ const { Session } = require('../models/index')
1414
1515const dbSelection = schemas . find ( ( { useFor } ) => useFor ?. includes ( 'session' ) )
1616
17- const sessionStore = new MySQLStore (
18- {
19- clearExpired : true ,
20- checkExpirationInterval : sessionCheckIntervalMs ,
21- createDatabaseTable : true ,
22- schema : {
23- tableName : sessionTableName ,
24- } ,
25- } ,
26- mysql2 . createPool ( {
27- host : dbSelection . host ,
28- port : dbSelection . port ,
29- user : dbSelection . username ,
30- password : dbSelection . password ,
31- database : dbSelection . database ,
32- } ) ,
33- )
17+ const sessionStore = dbSelection
18+ ? new MySQLStore (
19+ {
20+ clearExpired : true ,
21+ checkExpirationInterval : sessionCheckIntervalMs ,
22+ createDatabaseTable : true ,
23+ schema : {
24+ tableName : sessionTableName ,
25+ } ,
26+ } ,
27+ mysql2 . createPool ( {
28+ host : dbSelection . host ,
29+ port : dbSelection . port ,
30+ user : dbSelection . username ,
31+ password : dbSelection . password ,
32+ database : dbSelection . database ,
33+ } ) ,
34+ )
35+ : null
3436
3537const isValidSession = async ( userId ) => {
3638 try {
0 commit comments