diff --git a/backendspawner/backendspawner.py b/backendspawner/backendspawner.py index 814e682..9313149 100644 --- a/backendspawner/backendspawner.py +++ b/backendspawner/backendspawner.py @@ -92,13 +92,26 @@ def get_request_kwargs(self): request_kwargs = self.request_kwargs return request_kwargs - port = Union( + custom_port = Union( [Integer(), Callable()], default_value=8080, help=""" """, ).tag(config=True) + port = Integer( + help=""" + The port for single-user servers to listen on. + """, + ) + + @default('port') + def get_port(self): + port = self.custom_port + if callable(port): + port = port() + return port + async def get_port(self): if callable(self.port): port = await maybe_future(self.port(self))