Skip to content

Commit 74d96e3

Browse files
authored
Add Ports To Sandboxes (#1541)
<!-- This is an auto-generated description by cubic. --> ## Summary by cubic Adds a ports parameter to Sandbox to pre-expose specific ports via public URLs at creation. Defaults to [], and dynamic exposure via instance.expose_port(port) still works. <sup>Written for commit 8b233c7. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
1 parent b8f1829 commit 74d96e3

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

sdk/src/beta9/abstractions/sandbox.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ class Sandbox(Pod):
116116
# Docker daemon will be automatically started
117117
instance.docker.run("hello-world")
118118
```
119+
ports (Optional[List[int]]):
120+
List of ports to expose from the sandbox. When specified, these ports will be accessible
121+
via public URLs upon sandbox creation. Default is an empty list. You can also dynamically
122+
expose ports at runtime using `instance.expose_port(port)`.
119123
120124
Example:
121125
```python
@@ -158,6 +162,7 @@ def __init__(
158162
block_network: bool = False,
159163
allow_list: Optional[List[str]] = None,
160164
docker_enabled: bool = False,
165+
ports: Optional[List[int]] = [],
161166
):
162167
self.debug_buffer = io.StringIO()
163168
self.sync_local_dir = sync_local_dir
@@ -177,6 +182,7 @@ def __init__(
177182
block_network=block_network,
178183
allow_list=allow_list,
179184
docker_enabled=docker_enabled,
185+
ports=ports,
180186
)
181187

182188
def debug(self):

0 commit comments

Comments
 (0)