Skip to content

Commit

Permalink
Merge pull request #105 from daroga0002/hide-token-even-in-debug
Browse files Browse the repository at this point in the history
✨ hide token even in debug mode
  • Loading branch information
anarion80 authored Aug 1, 2024
2 parents 8492cb0 + 2a59649 commit 6d8503f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion custom_components/tech/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,22 @@ async def async_setup(hass: HomeAssistant, config: dict): # pylint: disable=unu
return True


def sanitize_entry_data(entry_data, key):
"""Return a copy of entry_data with the specified key field hidden."""
sanitized_data = entry_data.copy()
if key in sanitized_data:
sanitized_data[key] = "***HIDDEN***"
return str(sanitized_data)


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Tech Controllers from a config entry."""
_LOGGER.debug("Setting up component's entry.")
_LOGGER.debug("Entry id: %s", str(entry.entry_id))
_LOGGER.debug(
"Entry -> title: %s, data: %s, id: %s, domain: %s",
entry.title,
str(entry.data),
sanitize_entry_data(entry.data, "token"),
entry.entry_id,
entry.domain,
)
Expand Down

0 comments on commit 6d8503f

Please sign in to comment.