(connections_config)
| 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: |
no test coverage detected