Skip to content

Commit dfb1065

Browse files
author
Garito
committed
Allow to configure the session TTL
By a config key SESSION_TTL If not define, fall down to 1 day
1 parent e0117fa commit dfb1065

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

flask_mongoengine/sessions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ class DBSession(db.Document):
5252
def get_expiration_time(self, app, session):
5353
if session.permanent:
5454
return app.permanent_session_lifetime
55+
if 'SESSION_TTL' in app.config:
56+
return datetime.timedelta(**app.config['SESSION_TTL'])
5557
return datetime.timedelta(days=1)
5658

5759
def open_session(self, app, request):

0 commit comments

Comments
 (0)