File tree Expand file tree Collapse file tree
policyengine_household_api/modal_release Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Remove Modal gateway custom-domain registration and pin ` policyengine-core ` to version 3.26.5 or newer.
Original file line number Diff line number Diff line change 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
5024def 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
5728app = modal .App (GATEWAY_APP_NAME )
Original file line number Diff line number Diff 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" ,
Original file line number Diff line number Diff line change 44
55from 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
1312def 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
3520def test_gateway_web_endpoint_label_fits_modal_hostname_limit ():
You can’t perform that action at this time.
0 commit comments