Allow people to run commands like "flask db upgrade" without setting specific environment variables like FLASK_SESSION_SECRET_KEY everytime - they just need to add in their own /instance/config.py with their local configuration.
This commit is contained in:
parent
2a800e844f
commit
d46502cd2b
|
@ -94,13 +94,6 @@ def create_app() -> flask.app.Flask:
|
|||
app.config["CONNEXION_APP"] = connexion_app
|
||||
app.config["SESSION_TYPE"] = "filesystem"
|
||||
|
||||
if os.environ.get("FLASK_SESSION_SECRET_KEY") is None:
|
||||
raise KeyError(
|
||||
"Cannot find the secret_key from the environment. Please set"
|
||||
" FLASK_SESSION_SECRET_KEY"
|
||||
)
|
||||
|
||||
app.secret_key = os.environ.get("FLASK_SESSION_SECRET_KEY")
|
||||
|
||||
setup_config(app)
|
||||
db.init_app(app)
|
||||
|
|
|
@ -129,6 +129,14 @@ def setup_config(app: Flask) -> None:
|
|||
"SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR config must be set"
|
||||
)
|
||||
|
||||
if app.config["FLASK_SESSION_SECRET_KEY"] is None:
|
||||
raise KeyError(
|
||||
"Cannot find the secret_key from the environment. Please set"
|
||||
" FLASK_SESSION_SECRET_KEY"
|
||||
)
|
||||
|
||||
app.secret_key = os.environ.get("FLASK_SESSION_SECRET_KEY")
|
||||
|
||||
app.config["PROCESS_UUID"] = uuid.uuid4()
|
||||
|
||||
setup_database_uri(app)
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
import re
|
||||
from os import environ
|
||||
|
||||
FLASK_SESSION_SECRET_KEY = environ.get(
|
||||
"FLASK_SESSION_SECRET_KEY"
|
||||
)
|
||||
|
||||
SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR = environ.get(
|
||||
"SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR"
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue