From dc455b798f3425e8af2fdf61c4babb26858cd192 Mon Sep 17 00:00:00 2001 From: rachmadaniHaryono Date: Wed, 2 May 2018 20:34:01 +0800 Subject: [PATCH] chg: dev: app secret key --- bukuserver/README.rst | 18 +++++++++++------- bukuserver/server.py | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/bukuserver/README.rst b/bukuserver/README.rst index 3b01a11..166b877 100644 --- a/bukuserver/README.rst +++ b/bukuserver/README.rst @@ -45,13 +45,17 @@ Webserver Env config Following are available os env config available for bukuserver. -+-----------------------+------------------------------+ -| Name (without prefix) | Value and description | -+-----------------------+------------------------------+ -| PER_PAGE | v: [`10`]/(positive integer) | -| | | -| | Bookmark entry per page. | -+-----------------------+------------------------------+ ++-----------------------+--------------------------------+ +| Name (without prefix) | Value and description | ++-----------------------+--------------------------------+ +| PER_PAGE | v: [`10`]/(positive integer) | +| | | +| | Bookmark entry per page. | ++-----------------------+--------------------------------+ +| SECRET_KEY | v: [(os.urandom(24))]/(string) | +| | | +| | Server secret key. | ++-----------------------+--------------------------------+ Note: If any invalid input given, default value will be used diff --git a/bukuserver/server.py b/bukuserver/server.py index 6b15871..843b80d 100644 --- a/bukuserver/server.py +++ b/bukuserver/server.py @@ -521,7 +521,7 @@ def create_app(config_filename=None): per_page = int(os.getenv('BUKUSERVER_PER_PAGE', DEFAULT_PER_PAGE)) per_page = per_page if per_page > 0 else DEFAULT_PER_PAGE app.config['BUKUSERVER_PER_PAGE'] = per_page - app.config['SECRET_KEY'] = os.getenv('BUKUSERVER_SERVER_SECRET_KEY') or os.urandom(24) + app.config['SECRET_KEY'] = os.getenv('BUKUSERVER_SECRET_KEY') or os.urandom(24) bukudb = BukuDb() app.app_context().push() setattr(flask.g, 'bukudb', bukudb)