Skip to content

Commit 83ac791

Browse files
committed
Remove Modal custom domain wiring and pin core
1 parent a5b6b8c commit 83ac791

5 files changed

Lines changed: 12 additions & 60 deletions

File tree

changelog.d/1523.changed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove Modal gateway custom-domain registration and pin `policyengine-core` to version 3.26.5 or newer.

policyengine_household_api/modal_release/gateway_app.py

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,10 @@
1919
"HOUSEHOLD_MODAL_GATEWAY_WEB_ENDPOINT_LABEL",
2020
"household-api-gateway",
2121
)
22-
GATEWAY_CUSTOM_DOMAIN = "household.api.policyengine.org"
23-
24-
25-
def gateway_custom_domains(
26-
*,
27-
modal_environment: str | None = None,
28-
custom_domains: str | None = None,
29-
) -> tuple[str, ...]:
30-
if custom_domains is None:
31-
custom_domains = os.getenv("HOUSEHOLD_MODAL_GATEWAY_CUSTOM_DOMAINS")
32-
33-
if custom_domains is not None:
34-
return tuple(
35-
domain.strip()
36-
for domain in custom_domains.split(",")
37-
if domain.strip()
38-
)
39-
40-
environment = modal_environment or os.getenv("MODAL_ENVIRONMENT", "main")
41-
if environment == "main":
42-
return (GATEWAY_CUSTOM_DOMAIN,)
43-
44-
return ()
45-
46-
47-
GATEWAY_CUSTOM_DOMAINS = gateway_custom_domains()
4822

4923

5024
def gateway_wsgi_app_options() -> dict[str, object]:
51-
options: dict[str, object] = {"label": GATEWAY_WEB_ENDPOINT_LABEL}
52-
if GATEWAY_CUSTOM_DOMAINS:
53-
options["custom_domains"] = GATEWAY_CUSTOM_DOMAINS
54-
return options
25+
return {"label": GATEWAY_WEB_ENDPOINT_LABEL}
5526

5627

5728
app = modal.App(GATEWAY_APP_NAME)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ dependencies = [
2121
"inflect",
2222
"joserfc>=1.6.0",
2323
"modal>=1.3.0",
24+
"policyengine-core>=3.26.5",
2425
"policyengine_canada==0.96.3",
2526
"policyengine-ng==0.5.1",
2627
"policyengine-il==0.1.0",

tests/unit/modal_release/test_gateway_app.py

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,17 @@
44

55
from policyengine_household_api.modal_release.gateway_app import (
66
GATEWAY_APP_NAME,
7-
GATEWAY_CUSTOM_DOMAIN,
87
GATEWAY_WEB_ENDPOINT_LABEL,
9-
gateway_custom_domains,
8+
gateway_wsgi_app_options,
109
)
1110

1211

1312
def test_gateway_web_endpoint_label_is_short_and_stable():
1413
assert GATEWAY_WEB_ENDPOINT_LABEL == "household-api-gateway"
1514

1615

17-
def test_gateway_custom_domain_defaults_to_main_environment_only():
18-
assert gateway_custom_domains(modal_environment="main") == (
19-
GATEWAY_CUSTOM_DOMAIN,
20-
)
21-
assert gateway_custom_domains(modal_environment="staging") == ()
22-
assert gateway_custom_domains(modal_environment="testing") == ()
23-
24-
25-
def test_gateway_custom_domain_accepts_explicit_override():
26-
assert gateway_custom_domains(
27-
custom_domains="example.com, alt.example.com"
28-
) == (
29-
"example.com",
30-
"alt.example.com",
31-
)
32-
assert gateway_custom_domains(custom_domains="") == ()
16+
def test_gateway_wsgi_app_options_do_not_register_custom_domains():
17+
assert gateway_wsgi_app_options() == {"label": GATEWAY_WEB_ENDPOINT_LABEL}
3318

3419

3520
def test_gateway_web_endpoint_label_fits_modal_hostname_limit():

uv.lock

Lines changed: 6 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)