MCPcopy
hub / github.com/tortoise/tortoise-orm / star_password

Method star_password

tortoise/__init__.py:448–464  ·  view source on GitHub ↗
(connections_config)

Source from the content-addressed store, hash-verified

446
447 @staticmethod
448 def star_password(connections_config) -> str:
449 # Mask passwords to hide sensitive information in logs output
450 passwords = []
451 for name, info in connections_config.items():
452 if isinstance(info, str):
453 info = expand_db_url(info)
454 if password := info.get("credentials", {}).get("password"):
455 passwords.append(password)
456
457 str_connection_config = str(connections_config)
458 for password in passwords:
459 str_connection_config = str_connection_config.replace(
460 password,
461 # Show one third of the password at beginning (may be better for debugging purposes)
462 f"{password[0 : len(password) // 3]}***",
463 )
464 return str_connection_config
465
466 @classmethod
467 def _init_routers(cls, routers: list[str | type] | None = None) -> None:

Callers 1

initMethod · 0.80

Calls 3

expand_db_urlFunction · 0.90
itemsMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected