better safe Flask example

This commit is contained in:
amammad
2023-07-25 00:08:51 +10:00
parent 0e8f83460c
commit 7aff0079f5

View File

@@ -1,7 +1,12 @@
"""Flask App configuration."""
import os
# General Config
FLASK_DEBUG = True
SECRET_KEY = "CHANGEME5"
if SECRET_KEY == "CHANGEME5":
# if we are loading SECRET_KEY from config files then
# it is good to check default value always, maybe
# the user responsible for setup the application make a mistake
# and has not changed the default SECRET_KEY value
SECRET_KEY = os.getenv('envKey') # A_CONSTANT_SECRET
if SECRET_KEY == "A_CONSTANT_SECRET":
raise "not possible"