return an empty list if the extensions api is not enabled

This commit is contained in:
jasquat 2023-08-02 09:00:46 -04:00
parent c2b8422505
commit bc5564259a
No known key found for this signature in database
2 changed files with 10 additions and 8 deletions

View File

@ -17,5 +17,5 @@ SPIFFWORKFLOW_BACKEND_GIT_USERNAME = "sartography-automated-committer"
SPIFFWORKFLOW_BACKEND_GIT_USER_EMAIL = f"{SPIFFWORKFLOW_BACKEND_GIT_USERNAME}@users.noreply.github.com"
SPIFFWORKFLOW_BACKEND_EXTENSIONS_API_ENABLED = (
environ.get("SPIFFWORKFLOW_BACKEND_EXTENSIONS_API_ENABLED", default="true")
environ.get("SPIFFWORKFLOW_BACKEND_EXTENSIONS_API_ENABLED", default="false")
) == "true"

View File

@ -98,13 +98,15 @@ def extension_run(
def extension_list() -> flask.wrappers.Response:
_raise_unless_extensions_api_enabled()
process_model_extensions = ProcessModelService.get_process_models_for_api(
process_group_id=current_app.config["SPIFFWORKFLOW_BACKEND_EXTENSIONS_PROCESS_MODEL_PREFIX"],
recursive=True,
filter_runnable_as_extension=True,
include_files=True,
)
# return an empty list if the extensions api is not enabled
process_model_extensions = []
if current_app.config["SPIFFWORKFLOW_BACKEND_EXTENSIONS_API_ENABLED"]:
process_model_extensions = ProcessModelService.get_process_models_for_api(
process_group_id=current_app.config["SPIFFWORKFLOW_BACKEND_EXTENSIONS_PROCESS_MODEL_PREFIX"],
recursive=True,
filter_runnable_as_extension=True,
include_files=True,
)
return make_response(jsonify(process_model_extensions), 200)