|
71 | 71 | reachability, |
72 | 72 | state_callbacks, |
73 | 73 | storage_regen, |
| 74 | + validate, |
74 | 75 | ) |
75 | 76 | from ._yaml_search import ( |
76 | 77 | DEFAULT_CONTEXT_LINES, |
|
80 | 81 | from ._yaml_search_cache import YamlSearchCache |
81 | 82 | from .helpers import ( |
82 | 83 | _build_address_cache_args, |
83 | | - _redact_concealed_secrets, |
84 | 84 | _rewrite_required_yaml_leaf, |
85 | 85 | _validate_archive_configuration, |
86 | 86 | friendly_name_slugify, |
@@ -1515,32 +1515,14 @@ async def validate_config( |
1515 | 1515 | message_id: str = "", |
1516 | 1516 | **kwargs: Any, |
1517 | 1517 | ) -> None: |
1518 | | - """ |
1519 | | - Validate a device YAML config. Streams output per-connection. |
1520 | | -
|
1521 | | - ``show_secrets`` passes ``--show-secrets`` to ``esphome config`` |
1522 | | - so resolved ``!secret`` values appear in the output instead of |
1523 | | - the default ``<removed>`` redaction. Default is ``False`` — |
1524 | | - secrets only appear when the user actively asks for them. |
1525 | | - Mirrors the legacy dashboard's ``streamer_mode`` semantics |
1526 | | - but as a per-call opt-in rather than a global setting, so one |
1527 | | - user wanting to see secrets in a multi-user deployment doesn't |
1528 | | - change the default for everyone else. |
1529 | | - """ |
1530 | | - config_path = str(self._db.settings.rel_path(configuration)) |
1531 | | - cmd = [*self._esphome_cmd, "--dashboard", "config", config_path] |
1532 | | - line_transform: Callable[[str], str] | None = None |
1533 | | - if show_secrets: |
1534 | | - cmd.append("--show-secrets") |
1535 | | - else: |
1536 | | - # ``esphome config`` without ``--show-secrets`` doesn't |
1537 | | - # redact — it wraps each ``password|key|psk|ssid`` value |
1538 | | - # in the ANSI conceal SGR (8/28). Browsers don't honour |
1539 | | - # that escape, so the resolved secret bytes were leaking |
1540 | | - # plain into the validate dialog. Strip the wrapped runs |
1541 | | - # before the line leaves the WS handler. |
1542 | | - line_transform = _redact_concealed_secrets |
1543 | | - await self._stream_subprocess(cmd, client, message_id, line_transform=line_transform) |
| 1518 | + """Validate a device YAML config; streams output per-connection.""" |
| 1519 | + await validate.validate_config( |
| 1520 | + self, |
| 1521 | + configuration=configuration, |
| 1522 | + show_secrets=show_secrets, |
| 1523 | + client=client, |
| 1524 | + message_id=message_id, |
| 1525 | + ) |
1544 | 1526 |
|
1545 | 1527 | @api_command("devices/logs") |
1546 | 1528 | async def stream_logs( |
|
0 commit comments