[odrs-web/production] Set the secret key earlier



commit eb5d6a9b080085eccd0ab429fde3e0e801a2b4c7
Author: Richard Hughes <richard hughsie com>
Date:   Mon Sep 26 14:34:06 2016 +0100

    Set the secret key earlier

 flaskapp.py |   11 +----------
 1 files changed, 1 insertions(+), 10 deletions(-)
---
diff --git a/flaskapp.py b/flaskapp.py
index 89fd29e..3b1334e 100755
--- a/flaskapp.py
+++ b/flaskapp.py
@@ -15,14 +15,11 @@ from database import ReviewsDatabase, CursorError
 from user import OdrsUser
 
 app = Flask(__name__)
+app.secret_key = os.environ['ODRS_REVIEWS_SECRET']
 app.config.from_object(__name__)
 app.register_blueprint(api10, url_prefix='/1.0/reviews')
 app.register_blueprint(admin, url_prefix='/admin')
 
-# use the hash as the session key
-if 'ODRS_REVIEWS_SECRET' in os.environ:
-    app.secret_key = os.environ['ODRS_REVIEWS_SECRET']
-
 login_manager = LoginManager()
 login_manager.init_app(app)
 
@@ -81,10 +78,4 @@ def static_resource(resource):
 
 if __name__ == '__main__':
     app.debug = True
-
-    # we need this
-    if not 'ODRS_REVIEWS_SECRET' in os.environ:
-        os.environ['ODRS_REVIEWS_SECRET'] = 'dummy'
-        print('NO ODRS_REVIEWS_SECRET DEFINED, WE ARE INSECURE')
-
     app.run()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]