File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -55,15 +55,12 @@ async def connect(self) -> None:
5555 """Establish connection to PostgreSQL for listening to notifications."""
5656 try :
5757 # Parse the database URL for asyncpg connection
58- db_url = str (self .settings .SQLALCHEMY_DATABASE_URI )
59- if db_url .startswith ("postgresql://" ):
60- db_url = db_url .replace ("postgresql://" , "postgresql+asyncpg://" , 1 )
61- elif not db_url .startswith ("postgresql+asyncpg://" ):
62- # Fallback to direct connection params
63- db_url = "postgresql://postgres:password@localhost/postgres"
64-
65- # Remove the +asyncpg part for asyncpg.connect
66- connection_url = db_url .replace ("postgresql+asyncpg://" , "postgresql://" )
58+ db_url = self .settings .SQLALCHEMY_ASYNC_URI
59+
60+ # Remove the +asyncpg part for asyncpg.connect and unhide the password
61+ connection_url = db_url .render_as_string (False ).replace (
62+ "postgresql+asyncpg://" , "postgresql://"
63+ )
6764
6865 self .connection = await asyncpg .connect (connection_url )
6966 logger .info ("Connected to PostgreSQL for event listening" )
You can’t perform that action at this time.
0 commit comments