fix: hide configured token value in Web UI startup log
Only print the access token when auto-generated (user needs it to log in). When set via WEB_UI_TOKEN env var, just confirm it is set without exposing the value in console output.
This commit is contained in:
parent
44abe852fb
commit
a21f518c0b
1 changed files with 7 additions and 2 deletions
|
|
@ -66,7 +66,9 @@ class WebAdapter(BasePlatformAdapter):
|
||||||
# Config
|
# Config
|
||||||
self._host: str = config.extra.get("host", "127.0.0.1")
|
self._host: str = config.extra.get("host", "127.0.0.1")
|
||||||
self._port: int = config.extra.get("port", 8765)
|
self._port: int = config.extra.get("port", 8765)
|
||||||
self._token: str = config.extra.get("token", "") or secrets.token_hex(16)
|
configured_token = config.extra.get("token", "")
|
||||||
|
self._token: str = configured_token or secrets.token_hex(16)
|
||||||
|
self._token_auto_generated: bool = not configured_token
|
||||||
|
|
||||||
# Connected WebSocket clients: session_id -> ws
|
# Connected WebSocket clients: session_id -> ws
|
||||||
self._clients: Dict[str, web.WebSocketResponse] = {}
|
self._clients: Dict[str, web.WebSocketResponse] = {}
|
||||||
|
|
@ -110,7 +112,10 @@ class WebAdapter(BasePlatformAdapter):
|
||||||
for ip in all_ips:
|
for ip in all_ips:
|
||||||
if ip != primary_ip:
|
if ip != primary_ip:
|
||||||
print(f"[{self.name}] also: http://{ip}:{self._port}")
|
print(f"[{self.name}] also: http://{ip}:{self._port}")
|
||||||
print(f"[{self.name}] Access token: {self._token}")
|
if self._token_auto_generated:
|
||||||
|
print(f"[{self.name}] Access token (auto-generated): {self._token}")
|
||||||
|
else:
|
||||||
|
print(f"[{self.name}] Access token: (set via WEB_UI_TOKEN)")
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue