Merge pull request #216 from tiqi-group/config/changing_loading_behaviour

feat (config): changes web_port loading
This commit is contained in:
Mose Müller 2025-04-15 08:16:12 +02:00 committed by GitHub
commit b0dd5835a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -87,8 +87,10 @@ class Server:
service: The DataService instance that this server will manage. service: The DataService instance that this server will manage.
host: The host address for the server. Defaults to `'0.0.0.0'`, which means all host: The host address for the server. Defaults to `'0.0.0.0'`, which means all
available network interfaces. available network interfaces.
web_port: The port number for the web server. Defaults to web_port: The port number for the web server. If set to None, it will use the
[`ServiceConfig().web_port`][pydase.config.ServiceConfig.web_port]. port defined in
[`ServiceConfig().web_port`][pydase.config.ServiceConfig.web_port]. Defaults
to None.
enable_web: Whether to enable the web server. enable_web: Whether to enable the web server.
filename: Filename of the file managing the service state persistence. filename: Filename of the file managing the service state persistence.
additional_servers: A list of additional servers to run alongside the main additional_servers: A list of additional servers to run alongside the main
@ -140,7 +142,7 @@ class Server:
self, self,
service: DataService, service: DataService,
host: str = "0.0.0.0", host: str = "0.0.0.0",
web_port: int = ServiceConfig().web_port, web_port: int | None = None,
enable_web: bool = True, enable_web: bool = True,
filename: str | Path | None = None, filename: str | Path | None = None,
additional_servers: list[AdditionalServer] | None = None, additional_servers: list[AdditionalServer] | None = None,
@ -151,7 +153,10 @@ class Server:
additional_servers = [] additional_servers = []
self._service = service self._service = service
self._host = host self._host = host
self._web_port = web_port if web_port is None:
self._web_port = ServiceConfig().web_port
else:
self._web_port = web_port
self._enable_web = enable_web self._enable_web = enable_web
self._kwargs = kwargs self._kwargs = kwargs
self._additional_servers = additional_servers self._additional_servers = additional_servers