mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-12-04 19:15:30 +00:00
Read flask session type from environment variable and create sessions table if not exist.
This commit is contained in:
parent
68d9fb3755
commit
aa70951964
@ -93,7 +93,6 @@ legal_envvars_bool = (
|
||||
'SIGNUP_ENABLED',
|
||||
'LOCAL_DB_ENABLED',
|
||||
'LDAP_ENABLED',
|
||||
'SESSION_TYPE',
|
||||
'SESSION_COOKIE_SECURE',
|
||||
'CSRF_COOKIE_SECURE',
|
||||
'CAPTCHA_ENABLE',
|
||||
|
@ -56,8 +56,15 @@ def create_app(config=None):
|
||||
_sslify = SSLify(app) # lgtm [py/unused-local-variable]
|
||||
|
||||
# Load Flask-Session
|
||||
sess = Session()
|
||||
sess.init_app(app)
|
||||
app.config['SESSION_TYPE'] = app.config.get('SESSION_TYPE')
|
||||
if 'SESSION_TYPE' in os.environ:
|
||||
app.config['SESSION_TYPE'] = os.environ.get('SESSION_TYPE')
|
||||
|
||||
sess = Session(app)
|
||||
|
||||
# create sessions table if using sqlalchemy backend
|
||||
if os.environ.get('SESSION_TYPE') == 'sqlalchemy':
|
||||
sess.app.session_interface.db.create_all()
|
||||
|
||||
# SMTP
|
||||
app.mail = Mail(app)
|
||||
|
Loading…
Reference in New Issue
Block a user