Allow instance/config and/or config/testing to override default config

This commit is contained in:
mike cullerton 2022-07-14 09:36:36 -04:00
parent b844300e44
commit 0e7f12545c
1 changed files with 5 additions and 0 deletions

View File

@ -42,6 +42,11 @@ def setup_config(app: Flask) -> None:
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
app.config.from_object("spiffworkflow_backend.config.default")
# This allows config/testing.py or instance/config.py to override the default config
if 'ENV' in app.config and app.config['ENV'] == 'testing':
app.config.from_pyfile('config/testing.py', silent=True)
else:
app.config.from_pyfile(f'{app.instance_path}/config.py', silent=True)
setup_database_uri(app)
setup_logger(app)