wip
This commit is contained in:
@@ -8,14 +8,13 @@ if TYPE_CHECKING:
|
||||
else:
|
||||
DynamoDBClient = object
|
||||
|
||||
AWS_SAM_LOCAL = os.getenv('AWS_SAM_LOCAL')
|
||||
|
||||
|
||||
def get_dynamodb_client() -> DynamoDBClient:
|
||||
if not AWS_SAM_LOCAL:
|
||||
if os.getenv('AWS_LAMBDA_FUNCTION_NAME'):
|
||||
return boto3.client('dynamodb')
|
||||
|
||||
host = 'host.docker.internal' if AWS_SAM_LOCAL else '127.0.0.1'
|
||||
# Use the Docker network address when running in a container
|
||||
host = 'host.docker.internal' if os.getenv('AWS_SAM_LOCAL') else '127.0.0.1'
|
||||
return boto3.client('dynamodb', endpoint_url=f'http://{host}:8000')
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user