From f286f6493ce4857024adae75480ae4b4598fbda4 Mon Sep 17 00:00:00 2001 From: Duncan Ragsdale <88173870+Thistleman@users.noreply.github.com> Date: Mon, 6 Nov 2023 12:23:15 -0800 Subject: [PATCH] fixed missing env check for submission upload Signed-off-by: Duncan Ragsdale <88173870+Thistleman@users.noreply.github.com> --- valhub/submissions/views.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/valhub/submissions/views.py b/valhub/submissions/views.py index f2c72652..27fb8ccf 100644 --- a/valhub/submissions/views.py +++ b/valhub/submissions/views.py @@ -29,7 +29,16 @@ # Create your views here. -is_s3_emulation = True +def is_local(): + """ + Checks if the application is running locally or in an Amazon ECS environment. + + Returns: + bool: True if the application is running locally, False otherwise. + """ + return 'AWS_EXECUTION_ENV' not in os.environ and 'ECS_CONTAINER_METADATA_URI' not in os.environ and 'ECS_CONTAINER_METADATA_URI_V4' not in os.environ + +is_s3_emulation = is_local() @api_view(["POST"]) @authentication_classes([TokenAuthentication])