Skip to content

Commit 6fa3ad2

Browse files
committed
update container host name
1 parent 51f5164 commit 6fa3ad2

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

localstack-wiremock/localstack_wiremock/extension.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ class WireMockExtension(ProxiedDockerContainerExtension):
77
HOST = "wiremock.<domain>"
88
# name of the Docker image to spin up
99
DOCKER_IMAGE = "wiremock/wiremock"
10+
CONTAINER_NAME = "ls-wiremock"
1011

1112
def __init__(self):
1213
super().__init__(
1314
image_name=self.DOCKER_IMAGE,
1415
container_ports=[8080],
16+
container_name=self.CONTAINER_NAME,
1517
host=self.HOST,
1618
)

localstack-wiremock/sample-app/src/handler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def get_time_off(event, context):
1010
try:
1111
# Define the mock API endpoint URL (hardcoding `host.docker.internal` for now)
1212
# url = "http://wiremock.localhost.localstack.cloud:8080/company/time-offs/534813865"
13-
url = "http://host.docker.internal:8080/company/time-offs/534813865"
13+
url = "http://ls-wiremock:8080/company/time-offs/534813865"
1414

1515
# Make a GET request to the mock API
1616
response = requests.get(url, timeout=5)
@@ -41,6 +41,7 @@ def get_time_off(event, context):
4141
"message": "Could not connect to the downstream HR service.",
4242
"error": str(e),
4343
}
44+
print("Error:", error_message)
4445
return {
4546
"statusCode": 503, # Service Unavailable
4647
"headers": {"Content-Type": "application/json"},
@@ -49,6 +50,7 @@ def get_time_off(event, context):
4950
except Exception as e:
5051
# Handle other unexpected errors (e.g., JSON parsing issues, programming errors)
5152
error_message = {"message": "An unexpected error occurred.", "error": str(e)}
53+
print("Error:", error_message)
5254
return {
5355
"statusCode": 500, # Internal Server Error
5456
"headers": {"Content-Type": "application/json"},

0 commit comments

Comments
 (0)