8000 Update S3 to use new host config · localstack/localstack@c935265 · GitHub
[go: up one dir, main page]

Skip to content

Commit c935265

Browse files
committed
Update S3 to use new host config
1 parent bd97e9a commit c935265

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

localstack/services/s3/provider.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@
9494
preprocess_request,
9595
serve_custom_service_request_handlers,
9696
)
97-
from localstack.constants import LOCALHOST_HOSTNAME
9897
from localstack.services.edge import ROUTER
9998
from localstack.services.moto import call_moto
10099
from localstack.services.plugins import ServiceLifecycleHook
@@ -130,6 +129,7 @@
130129
from localstack.utils.collections import get_safe
131130
from localstack.utils.patch import patch
132131
from localstack.utils.strings import short_uid
132+
from localstack.utils.urls import localstack_host
133133

134134
LOG = logging.getLogger(__name__)
135135

@@ -166,8 +166,11 @@ def __init__(self, message=None):
166166

167167
def get_full_default_bucket_location(bucket_name):
168168
if config.HOSTNAME_EXTERNAL != config.LOCALHOST:
169-
return f"{config.get_protocol()}://{config.HOSTNAME_EXTERNAL}:{config.get_edge_port_http()}/{bucket_name}/"
170-
return f"{config.get_protocol()}://{bucket_name}.s3.{LOCALHOST_HOSTNAME}:{config.get_edge_port_http()}/"
169+
host_definition = localstack_host(use_hostname_external=True)
170+
return f"{config.get_protocol()}://{host_definition.host_and_port()}/{bucket_name}/"
171+
else:
172+
host_definition = localstack_host(use_localhost_cloud=True)
173+
return f"{config.get_protocol()}://{bucket_name}.s3.{host_definition.host_and_port()}/"
171174

172175

173176
class S3Provider(S3Api, ServiceLifecycleHook):

0 commit comments

Comments
 (0)
0