Permalink
Browse files

Generate a secret key on first installation so we can have real publi…

…c source

Signed-off-by: Chris Lamb <lamby@debian.org>
  • Loading branch information...
1 parent 47e79bb commit c8d1f2ed86d1a6d8b001c98139a758fb6b14dff1 @lamby lamby committed Sep 19, 2012
Showing with 17 additions and 1 deletion.
  1. +12 −0 debian/postinst
  2. +5 −1 src/librement/settings/defaults/__init__.py
View
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#DEBHELPER#
+
+set -eu
+
+mkdir -p /var/lib/librement
+
+if [ ! -f /var/lib/librement/key ]
+then
+ pwgen -s 50 > /var/lib/librement/key
+fi
@@ -59,7 +59,11 @@
MEDIA_URL = '/storage/'
# Make this unique, and don't share it with anybody.
-SECRET_KEY = 'swwG4rLmoCMYkKn46r1bOtZLlnUAXFatwY9pv6pzyysYcssHShzse7WSq'
+try:
+ with open('/var/lib/librement/key', 'r') as f:
+ SECRET_KEY = f.read().strip()
+except IOError:
+ SECRET_KEY = 'swwG4rLmoCMYkKn46r1bOtZLlnUAXFatwY9pv6pzyysYcssHShzse7WSq'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (

0 comments on commit c8d1f2e

Please sign in to comment.