From 3068763a37193e0affe48608011d86aa25e8de83 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Tue, 16 Feb 2016 07:50:17 +0100 Subject: I now know why my sessios was always lost on Heroku... --- src/bootstrap.py | 4 +++- src/conf.py | 2 ++ src/conf/conf.cfg-sample | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/bootstrap.py b/src/bootstrap.py index f7a3754c..25528ef5 100644 --- a/src/bootstrap.py +++ b/src/bootstrap.py @@ -40,7 +40,9 @@ application.config['PREFERRED_URL_SCHEME'] = scheme set_logging(conf.LOG_PATH, log_level=conf.LOG_LEVEL) # Create secrey key so we can use sessions -application.config['SECRET_KEY'] = os.urandom(12) +application.config['SECRET_KEY'] = getattr(conf, 'WEBSERVER_SECRET', None) +if not application.config['SECRET_KEY']: + application.config['SECRET_KEY'] = os.urandom(12) application.config['RECAPTCHA_USE_SSL'] = True application.config['RECAPTCHA_PUBLIC_KEY'] = conf.RECAPTCHA_PUBLIC_KEY diff --git a/src/conf.py b/src/conf.py index 628a27d3..d65bb516 100644 --- a/src/conf.py +++ b/src/conf.py @@ -35,6 +35,7 @@ DEFAULTS = {"platform_url": "https://jarr.herokuapp.com/", "log_path": "jarr.log", "log_level": "info", "user_agent": "JARR (https://github.com/JARR-aggregator)", + "secret_key": "", "enabled": "false", "notification_email": "jarr@no-reply.com", "tls": "false", @@ -98,6 +99,7 @@ LOG_LEVEL = {'debug': logging.DEBUG, WEBSERVER_HOST = config.get('webserver', 'host') WEBSERVER_PORT = config.getint('webserver', 'port') +WEBSERVER_SECRET = config.get('webserver', 'secret_key') CDN_ADDRESS = config.get('cdn', 'cdn_address') diff --git a/src/conf/conf.cfg-sample b/src/conf/conf.cfg-sample index 3d7a27a6..cc37a4a2 100644 --- a/src/conf/conf.cfg-sample +++ b/src/conf/conf.cfg-sample @@ -1,6 +1,7 @@ [webserver] host = 127.0.0.1 port = 5000 +secret_key = a secret only you know [cdn] cdn_address = https://cdn.cedricbonhomme.org/ [misc] -- cgit