Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed mongo db url readout from env variable #92

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion databases.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ def __init__(self, **kwargs: Unpack[DatabaseParams]) -> None:
def hostname(self) -> str:
"""Return the hostname including the port. Strips usernames and passwords."""
# strip usernames and password
return self.__params["host"][self.__params["host"].find("@") + 1 : self.__params["host"].rfind("/?")]
last_occurance = self.__params["host"].rfind("/?")
return self.__params["host"][
self.__params["host"].find("@") + 1 : last_occurance if last_occurance >= 0 else len(self.__params["host"])
]

async def __aenter__(self) -> Self:
await self.__connect()
Expand Down Expand Up @@ -179,6 +182,9 @@ def _log_database_error(
)

async def monitor_changes(self, timeout: float) -> None:
"""
Will be called by the DatabaseManager context manager to produce a stream of database changes
"""
raise NotImplementedError

async def _monitor_database(
Expand Down