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 09794e9302
commit 2198c0444f
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_GIT_USER_EMAIL = f"{SPIFFWORKFLOW_BACKEND_GIT_USERNAME}@users.noreply.github.com"
SPIFFWORKFLOW_BACKEND_EXTENSIONS_API_ENABLED = ( SPIFFWORKFLOW_BACKEND_EXTENSIONS_API_ENABLED = (
environ.get("SPIFFWORKFLOW_BACKEND_EXTENSIONS_API_ENABLED", default="true") environ.get("SPIFFWORKFLOW_BACKEND_EXTENSIONS_API_ENABLED", default="false")
) == "true" ) == "true"

View File

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