IMP session_redis allow setting prefix through config file

This commit is contained in:
Jared Kipe
2019-10-11 14:11:56 -07:00
parent 50907f7d6e
commit ac5b6e86fc
2 changed files with 2 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ session_redis = True
;session_redis_dbindex = 1
;session_redis_pass = x
;session_redis_expire = 604800
;session_redis_prefix = test
""",
"summary": "",

View File

@@ -29,7 +29,7 @@ class RedisSessionStore(werkzeug.contrib.sessions.SessionStore):
self.expire = kwargs.get('expire', DEFAULT_SESSION_TIMEOUT)
if self.expire == DEFAULT_SESSION_TIMEOUT:
self.expire = int(tools.config.get('session_redis_expire', DEFAULT_SESSION_TIMEOUT))
self.key_prefix = kwargs.get('key_prefix', '')
self.key_prefix = kwargs.get('key_prefix', tools.config.get('session_redis_prefix', ''))
self.redis = redis.Redis(
host=tools.config.get('session_redis_host', 'localhost'),
port=int(tools.config.get('session_redis_port', 6379)),