wip
This commit is contained in:
19
id.saladeaula.digital/app/boto3clients.py
Normal file
19
id.saladeaula.digital/app/boto3clients.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import os
|
||||
|
||||
import boto3
|
||||
|
||||
|
||||
def get_dynamodb_client():
|
||||
running_sam_local = os.getenv('AWS_SAM_LOCAL')
|
||||
|
||||
if os.getenv('AWS_LAMBDA_FUNCTION_NAME') and not running_sam_local:
|
||||
return boto3.client('dynamodb')
|
||||
|
||||
dockerhost = 'host.docker.internal'
|
||||
localhost = '127.0.0.1'
|
||||
host = dockerhost if running_sam_local else localhost
|
||||
|
||||
return boto3.client('dynamodb', endpoint_url=f'http://{host}:8000')
|
||||
|
||||
|
||||
dynamodb_client = get_dynamodb_client()
|
||||
Reference in New Issue
Block a user