Fix handling of secret key: We now generate it on app startup if it doesn't exist in the config (which it doesn't anymore in the base config.py).
This commit is contained in:
parent
1bf25f25c1
commit
40d2b1748f
6 changed files with 11 additions and 5 deletions
7
app.py
7
app.py
|
@ -19,7 +19,7 @@ from util.exceptionlog import Sentry
|
|||
from util.queuemetrics import QueueMetrics
|
||||
from util.names import urn_generator
|
||||
from util.oauth import GoogleOAuthConfig, GithubOAuthConfig
|
||||
from util.configutil import import_yaml
|
||||
from util.configutil import import_yaml, generate_secret_key
|
||||
from data.billing import Billing
|
||||
from data.buildlogs import BuildLogs
|
||||
from data.archivedlogs import LogArchive
|
||||
|
@ -139,5 +139,10 @@ 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()
|
||||
|
||||
def get_app_url():
|
||||
return '%s://%s' % (app.config['PREFERRED_URL_SCHEME'], app.config['SERVER_HOSTNAME'])
|
||||
|
|
Reference in a new issue