Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 086b121

Browse files
committed
Remove legacy variable config.EDGE_PORT
1 parent d4cd702 commit 086b121

File tree

3 files changed

+3
-16
lines changed

3 files changed

+3
-16
lines changed

‎localstack/config.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ def append(self, value: HostAndPort):
594594

595595
def populate_edge_configuration(
596596
environment: Mapping[str, str]
597-
) -> Tuple[HostAndPort, UniqueHostAndPortList, int]:
597+
) -> Tuple[HostAndPort, UniqueHostAndPortList]:
598598
"""Populate the LocalStack edge configuration from environment variables."""
599599
localstack_host_raw = environment.get("LOCALSTACK_HOST")
600600
gateway_listen_raw = environment.get("GATEWAY_LISTEN")
@@ -629,13 +629,9 @@ def populate_edge_configuration(
629629
assert gateway_listen is not None
630630
assert localstack_host is not None
631631

632-
# derive legacy variables from GATEWAY_LISTEN
633-
edge_port = gateway_listen[0].port
634-
635632
return (
636633
localstack_host,
637634
UniqueHostAndPortList(gateway_listen),
638-
edge_port,
639635
)
640636

641637

@@ -647,8 +643,6 @@ def populate_edge_configuration(
647643
# Main configuration of the listen address of the hypercorn proxy. Of the form
648644
# <ip_address>:<port>(,<ip_address>:port>)*
649645
GATEWAY_LISTEN,
650-
# -- Legacy variables
651-
EDGE_PORT,
652646
) = populate_edge_configuration(os.environ)
653647

654648
# IP of the docker bridge used to enable access between containers

‎tests/integration/utils/test_diagnose.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ def test_diagnose_resource():
1010

1111
assert "/tmp" in result["file-tree"]
1212
assert "/var/lib/localstack" in result["file-tree"]
13-
assert result["config"]["EDGE_PORT"] == config.EDGE_PORT
1413
assert result["config"]["DATA_DIR"] == config.DATA_DIR
1514
assert result["config"]["GATEWAY_LISTEN"] == [config.HostAndPort("0.0.0.0", 4566)]
1615
assert result["important-endpoints"]["localhost.localstack.cloud"].startswith("127.0.")

‎tests/unit/test_config.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,30 +138,26 @@ def test_edge_configuration(
138138
(
139139
actual_ls_host,
140140
actual_gateway_listen,
141-
actual_edge_port,
142141
) = config.populate_edge_configuration(environment)
143142

144143
assert actual_ls_host == expected_localstack_host
145144
assert actual_gateway_listen == expected_gateway_listen
146-
assert actual_edge_port == expected_edge_port
147145

148146
def test_gateway_listen_multiple_addresses(self):
149147
environment = {"GATEWAY_LISTEN": "0.0.0.0:9999,0.0.0.0:443"}
150148
(
151149
_,
152150
gateway_listen,
153-
edge_port,
154151
) = config.populate_edge_configuration(environment)
155152

156153
assert gateway_listen == [
157154
HostAndPort(host="0.0.0.0", port=9999),
158155
HostAndPort(host="0.0.0.0", port=443),
159156
]
160-
# take the first value
161-
assert edge_port == 9999
162157

163158
def test_legacy_variables_ignored_if_given(self):
164-
"""Providing legacy variables removed in 3.0 should not affect the default configuration"""
159+
"""Providing legacy variables removed in 3.0 should not affect the default configuration.
160+
This test can be removed around >3.1-4.0."""
165161
environment = {
166162
"EDGE_BIND_HOST": "192.168.0.1",
167163
"EDGE_PORT": "10101",
@@ -170,14 +166,12 @@ def test_legacy_variables_ignored_if_given(self):
170166
(
171167
localstack_host,
172168
gateway_listen,
173-
edge_port,
174169
) = config.populate_edge_configuration(environment)
175170

176171
assert localstack_host == "localhost.localstack.cloud:4566"
177172
assert gateway_listen == [
178173
HostAndPort(host=ip(), port=4566),
179174
]
180-
assert edge_port == 4566
181175

182176

183177
class TestUniquePortList:

0 commit comments

Comments
 (0)