Skip to content

Commit 48e587f

Browse files
committed
BE: DEEP_SLEEP #1555 co-author @legionGer
Signed-off-by: jokob-sk <jokob.sk@gmail.com>
1 parent 2fa62a2 commit 48e587f

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

server/api.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,14 @@ def update_GUI_port():
262262
Grabs the PORT for the webinterface and converts it to HEX to use for activity checks
263263
"""
264264
global hex_gui_port
265-
gui_port_string = port = os.environ.get('PORT', defaultWebPort)
266-
hex_gui_port = ':'+format(int(gui_port_string), '04X')
265+
266+
gui_port_string = os.environ.get('PORT', str(defaultWebPort))
267+
try:
268+
port = int(gui_port_string)
269+
except (TypeError, ValueError):
270+
mylog("none", [f"[API] Invalid PORT value '{gui_port_string}', falling back to {defaultWebPort}"])
271+
port = defaultWebPort
272+
hex_gui_port = ':' + format(port, '04X')
267273

268274

269275
def check_activity():

0 commit comments

Comments
 (0)