Added API mapping and custom Domain

This commit is contained in:
2024-05-30 14:17:04 +02:00
parent d7903bf59a
commit 8de6d1d7b6
8 changed files with 587 additions and 117 deletions

View File

@@ -10,6 +10,7 @@ bucket_config = ''
bucket_data = ''
function_url = ''
git_version = ''
api_verson = ''
s3_client = None
redirects: Redirects | None = None
@@ -36,7 +37,7 @@ class Record(BaseModel):
s3: S3Event
def lambda_handler(event: dict, context):
global s3_client, bucket_config, bucket_data, function_url, redirects, git_version
global s3_client, bucket_config, bucket_data, function_url, redirects, git_version, api_version
if s3_client is None:
print("Init Function")
@@ -44,6 +45,7 @@ def lambda_handler(event: dict, context):
bucket_data = os.environ.get('BUCKET_DATA', 'standout-data')
function_url = os.environ.get('FUNCTION_URL', 'https://api.standout.it/dev')
git_version = os.environ.get('GIT_VERSION', '00000000')
api_version = os.environ.get('API_VERSION', 'v1')
print(f' Version: {git_version}')
print(f' Bucket Data: {bucket_data}')
@@ -174,7 +176,7 @@ def processAdd(record: Record, redirects: Redirects, client) -> None:
print(f"ObjectCreated: {record.s3.object.key}")
def generateTagUrl(cust_id: str, tag_id: str, face_id: str | None) -> str:
return f"{function_url}/api?id={cust_id}&tag_id={tag_id}{f"&face_id={face_id}" if face_id else ""}"
return f"{function_url}/{api_version}?id={cust_id}&tag_id={tag_id}{f"&face_id={face_id}" if face_id else ""}"
def searchCustomerKey(redirects: Redirects, cust_name: str, default: str | None) -> str | None:
if redirects.customers is None: