Move secret key generation before we load users of config, as they may reference it

This commit is contained in:
Joseph Schorr 2015-08-24 16:09:01 -04:00
parent 1450b7e84c
commit e56115d9d2

10
app.py
View file

@ -106,6 +106,11 @@ for handler in logging.getLogger().handlers:
app.request_class = RequestWithId
# Generate a secret key if none was specified.
if app.config['SECRET_KEY'] is None:
logger.debug('Generating in-memory secret key')
app.config['SECRET_KEY'] = generate_secret_key()
features.import_features(app.config)
Principal(app, use_sessions=False)
@ -144,11 +149,6 @@ database.configure(app.config)
model.config.app_config = app.config
model.config.store = storage
# Generate a secret key if none was specified.
if app.config['SECRET_KEY'] is None:
logger.debug('Generating in-memory secret key')
app.config['SECRET_KEY'] = generate_secret_key()
@login_manager.user_loader
def load_user(user_uuid):
logger.debug('User loader loading deferred user with uuid: %s' % user_uuid)