Add secret key fallback with warning.
This commit is contained in:
parent
3c02ce279e
commit
aa212e2f1f
|
@ -1,6 +1,7 @@
|
|||
# Copyright Sage Vaillancourt 2021
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from flask import Flask
|
||||
|
||||
|
@ -12,8 +13,12 @@ def create_app(test_config=None):
|
|||
optimize_css_file()
|
||||
|
||||
app = Flask(__name__, instance_relative_config=True)
|
||||
secret_key = os.environ.get('UNDERCOVER_SECRET_KEY')
|
||||
if not secret_key:
|
||||
sys.stderr.write("WARNING: UNDERCOVER_SECRET_KEY is not defined! Application may be insecure.\n")
|
||||
secret_key = "dev"
|
||||
app.config.from_mapping(
|
||||
SECRET_KEY=os.environ['UNDERCOVER_SECRET_KEY'],
|
||||
SECRET_KEY=secret_key,
|
||||
# DATABASE=os.path.join(app.instance_path, 'undercover.sqlite'),
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue