fix(session-middleware): don't hardcode database ttl

The cookie expiration is taken from the config,
but the expiration of session data in the database was hardcoded.

This removes the hardcoded value, so TypeormStore defaults
to cookie.maxAge.

References:
https://github.com/nykula/connect-typeorm#options
https://github.com/expressjs/session#cookiemaxage
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2022-02-27 20:44:20 +01:00
parent cf5c398933
commit 931a168e5d

View file

@ -32,7 +32,6 @@ export function setupSessionMiddleware(
saveUninitialized: false, saveUninitialized: false,
store: new TypeormStore({ store: new TypeormStore({
cleanupLimit: 2, cleanupLimit: 2,
ttl: 86400,
}).connect(app.get<Repository<Session>>(getRepositoryToken(Session))), }).connect(app.get<Repository<Session>>(getRepositoryToken(Session))),
}), }),
); );