make git commit on save configurable

This commit is contained in:
burnettk 2022-10-04 15:07:48 -04:00
parent 8c5e11ca68
commit 427960698d
3 changed files with 14 additions and 4 deletions

View File

@ -23,6 +23,10 @@ SPIFFWORKFLOW_BACKEND_URL = environ.get(
"SPIFFWORKFLOW_BACKEND_URL", default="http://localhost:7000"
)
GIT_COMMIT_ON_SAVE = (
environ.get("GIT_COMMIT_ON_SAVE", default="false") == "true"
)
# Open ID server
OPEN_ID_SERVER_URL = environ.get("OPEN_ID_SERVER_URL", default="http://localhost:7002")
OPEN_ID_CLIENT_ID = environ.get("OPEN_ID_CLIENT_ID", default="spiffworkflow-backend")

View File

@ -1 +1,2 @@
"""Staging."""
GIT_COMMIT_ON_SAVE = True

View File

@ -270,10 +270,15 @@ def process_model_file_update(
)
SpecFileService.update_file(process_model, file_name, request_file_contents)
git_output = GitService.commit(
message=f"User: {g.user.username} clicked save for {process_group_id}/{process_model_id}/{file_name}"
)
current_app.logger.info(f"git output: {git_output}")
if current_app.config["GIT_COMMIT_ON_SAVE"]:
git_output = GitService.commit(
message=f"User: {g.user.username} clicked save for {process_group_id}/{process_model_id}/{file_name}"
)
current_app.logger.info(f"git output: {git_output}")
else:
current_app.logger.info("Git commit on save is disabled")
return Response(json.dumps({"ok": True}), status=200, mimetype="application/json")