Skip to content

Commit

Permalink
Add SAFE_DEV_MODE env that disables post requests to API (#175)
Browse files Browse the repository at this point in the history
* Update display_callbacks.py

* Handle through config

* Bug fix
  • Loading branch information
vanderlindenma authored Nov 14, 2024
1 parent ef3b5e9 commit 6e77937
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/callbacks/display_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,9 @@ def acknowledge_event(n_clicks, event_id_on_display, user_headers, user_credenti
if event_id_on_display == 0 or n_clicks == 0:
raise PreventUpdate

if cfg.SAFE_DEV_MODE == "True":
raise PreventUpdate

user_token = user_headers["Authorization"].split(" ")[1]
api_client.token = user_token
call_api(api_client.acknowledge_event, user_credentials)(event_id=int(event_id_on_display))
Expand Down
3 changes: 3 additions & 0 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
SENTRY_DSN: Optional[str] = os.getenv("SENTRY_DSN")
SERVER_NAME: Optional[str] = os.getenv("SERVER_NAME")

# Safeguards
SAFE_DEV_MODE: Optional[str] = os.getenv("SAFE_DEV_MODE")

# App config variables
MAX_ALERTS_PER_EVENT = 10
CAM_OPENING_ANGLE = 87
Expand Down

0 comments on commit 6e77937

Please sign in to comment.