Skip to content

Commit 732a98a

Browse files
committed
refactor: read verify_ssl from server.settings instead of server.client
Per Gemini review on PR homeassistant-ai#1128: server.client is a lazy @Property (server.py) — accessing it for a single config bool would instantiate the full HomeAssistantClient (httpx pool, settings re-read, log line) on first access. server.settings is eager-initialized in the HomeAssistantSmartMCPServer constructor and is the canonical source of truth for verify_ssl. Additional benefit: in OAuth deployment mode (__main__.py:868), HomeAssistantSmartMCPServer is constructed with an OAuthProxyClient whose __getattr__ proxies to a per-request OAuth client requiring an authenticated request context. _restart_addon is a plain admin POST without that context, so server.client.verify_ssl could have surfaced as an auth error in OAuth mode. server.settings.verify_ssl sidesteps it without depending on OAuthProxyClient's attribute-forwarding semantics.
1 parent d2f5f3f commit 732a98a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/ha_mcp/settings_ui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ async def _restart_addon(_: Request) -> JSONResponse:
791791
# the connection will drop. A connection drop is actually success.
792792
try:
793793
async with httpx.AsyncClient(
794-
timeout=5.0, verify=server.client.verify_ssl
794+
timeout=5.0, verify=server.settings.verify_ssl
795795
) as client:
796796
resp = await client.post(
797797
"http://supervisor/addons/self/restart",

0 commit comments

Comments
 (0)