fix retain key

This commit is contained in:
2025-05-23 10:30:54 -03:00
parent 812470aae4
commit a7ee787378
26 changed files with 117 additions and 166 deletions

View File

@@ -2,15 +2,16 @@ import os
import boto3
DYNAMODB_ENDPOINT_URL: str | None = None
# Only when running `sam local start-api`
if 'AWS_SAM_LOCAL' in os.environ:
DYNAMODB_ENDPOINT_URL = 'http://host.docker.internal:8000'
def get_dynamodb_client():
sam_local = os.getenv('AWS_SAM_LOCAL')
# Only when running `pytest`
if 'PYTEST_VERSION' in os.environ:
DYNAMODB_ENDPOINT_URL = 'http://127.0.0.1:8000'
if os.getenv('AWS_LAMBDA_FUNCTION_NAME') and not sam_local:
return boto3.client('dynamodb')
dynamodb_client = boto3.client('dynamodb', endpoint_url=DYNAMODB_ENDPOINT_URL)
url = 'host.docker.internal' if sam_local else 'localhost'
return boto3.client('dynamodb', endpoint_url=f'http://{url}:8000')
dynamodb_client = get_dynamodb_client()
idp_client = boto3.client('cognito-idp')