Skip to content

Commit 759788f

Browse files
committed
Allow specifying a hostname
1 parent 494cc4f commit 759788f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

server.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,16 @@ def __init__(
160160
server_cert: str = _if_conf_exists('SERVER_CERT'),
161161
conf = CUBESERVER_DEFAULT_CONFIG,
162162
verbose: bool = False,
163-
_force: bool = False
163+
_force: bool = False,
164+
_hostname: str = ""
164165
):
165166
"""Initializes the connection to the server"""
166167
# Check parameters:
167-
if not _force and \
168-
team_name is None or \
169-
team_secret is None or \
170-
server_cert is None or \
168+
if not _force and (
169+
team_name is None or \
170+
team_secret is None or \
171+
server_cert is None
172+
) or \
171173
not isinstance(conf, ConnectionConfig):
172174
raise TypeError("Bad parameters or client config")
173175
self.team_name = team_name
@@ -176,6 +178,9 @@ def __init__(
176178
self.conf = conf
177179
self.v = verbose
178180

181+
if _hostname:
182+
wifi.radio.hostname = _hostname
183+
179184
if self.v:
180185
print("Obtaining and configuring SSL context...")
181186
self.context = ssl.create_default_context()

0 commit comments

Comments
 (0)