aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-02-16 07:50:17 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-02-16 07:50:17 +0100
commit3068763a37193e0affe48608011d86aa25e8de83 (patch)
treeb21fd941e12f55e2e43b1432a8e0cdb5c147371f
parentIt is again possible (for an administrator) to delete the feed of a user. (diff)
downloadnewspipe-3068763a37193e0affe48608011d86aa25e8de83.tar.gz
newspipe-3068763a37193e0affe48608011d86aa25e8de83.tar.bz2
newspipe-3068763a37193e0affe48608011d86aa25e8de83.zip
I now know why my sessios was always lost on Heroku...
-rw-r--r--app.json1
-rw-r--r--src/bootstrap.py4
-rw-r--r--src/conf.py2
-rw-r--r--src/conf/conf.cfg-sample1
4 files changed, 7 insertions, 1 deletions
diff --git a/app.json b/app.json
index 164eff7e..30610806 100644
--- a/app.json
+++ b/app.json
@@ -16,6 +16,7 @@
"CDN_ADDRESS": "https://cdn.cedricbonhomme.org/",
"ADMIN_EMAIL": "root@jarr.localhost",
"ADMIN_PASSWORD": "password",
+ "SECRET_KEY": "a secret only you know in order to use sessions",
"NOTIFICATION_EMAIL": "JARR@no-reply.com",
"RECAPTCHA_PRIVATE_KEY": "REDACTED",
"RECAPTCHA_PUBLIC_KEY": "REDACTED",
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]
bgstack15