Skip to content

Commit b0dd7ea

Browse files
PR feedback: Refactor get_nginx_service_config to use service.cors_enabled.
1 parent da461fe commit b0dd7ea

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/dstack/_internal/proxy/gateway/services/registry.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,7 @@ async def apply_service(
263263
ReplicaConfig(id=replica.id, socket=conn.app_socket_path)
264264
for replica, conn in replica_conns.items()
265265
]
266-
service_config = await get_nginx_service_config(
267-
service, replica_configs, cors_enabled=service.cors_enabled
268-
)
266+
service_config = await get_nginx_service_config(service, replica_configs)
269267
await nginx.register(service_config, (await repo.get_config()).acme_settings)
270268
return replica_failures
271269

@@ -309,7 +307,7 @@ async def stop_replica_connections(
309307

310308

311309
async def get_nginx_service_config(
312-
service: models.Service, replicas: Iterable[ReplicaConfig], cors_enabled: bool = False
310+
service: models.Service, replicas: Iterable[ReplicaConfig]
313311
) -> ServiceConfig:
314312
limit_req_zones: list[LimitReqZoneConfig] = []
315313
locations: list[LocationConfig] = []
@@ -378,7 +376,7 @@ async def get_nginx_service_config(
378376
locations=locations,
379377
replicas=sorted(replicas, key=lambda r: r.id), # sort for reproducible configs
380378
router=service.router,
381-
cors_enabled=cors_enabled,
379+
cors_enabled=service.cors_enabled,
382380
)
383381

384382

0 commit comments

Comments
 (0)