Skip to content

Commit

Permalink
feat: make all attrs configurable via flask config
Browse files Browse the repository at this point in the history
  • Loading branch information
giuppep committed May 20, 2023
1 parent a6d8286 commit e6ecaab
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions flask_pg_session/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
DEFAULT_KEY_PREFIX = ""
DEFAULT_USE_SIGNER = False
DELETE_EXPIRED_SESSIONS_EVERY_REQUESTS = 1000
DEFAULT_PG_MAX_DB_CONN = 100


# This is copied verbatim from flask-session
Expand Down Expand Up @@ -60,6 +61,12 @@ def init_app(cls, app: Flask) -> "FlaskPgSession":
key_prefix=app.config.get("SESSION_KEY_PREFIX", DEFAULT_KEY_PREFIX),
use_signer=app.config.get("SESSION_USE_SIGNER", DEFAULT_USE_SIGNER),
permanent=app.config.get("SESSION_PERMANENT", True),
autodelete_expired_sessions=app.config.get(
"SESSION_AUTODELETE_EXPIRED", True
),
max_db_conn=app.config.get(
"SESSION_PG_MAX_DB_CONN", DEFAULT_PG_MAX_DB_CONN
),
)
app.session_interface = session_interface
return session_interface
Expand Down

0 comments on commit e6ecaab

Please sign in to comment.