fix: update database_url configuration for async engine to use host and port
This commit is contained in:
@@ -10,21 +10,22 @@ from .config import (
|
|||||||
PG_PASSWORD,
|
PG_PASSWORD,
|
||||||
)
|
)
|
||||||
|
|
||||||
database_url = (
|
|
||||||
f"postgresql+asyncpg://"
|
|
||||||
f"{PG_LOGIN}:{PG_PASSWORD}@"
|
|
||||||
f"/{PG_DATABASE}?host=/run/postgresql/"
|
|
||||||
)
|
|
||||||
|
|
||||||
# database_url = (
|
# database_url = (
|
||||||
# f"postgresql+asyncpg://"
|
# f"postgresql+asyncpg://"
|
||||||
# f"{PG_LOGIN}:{PG_PASSWORD}@"
|
# f"{PG_LOGIN}:{PG_PASSWORD}@"
|
||||||
# f"{PG_HOST}:{PG_PORT}/{PG_DATABASE}"
|
# f"/{PG_DATABASE}?host=/run/postgresql/"
|
||||||
# )
|
# )
|
||||||
|
|
||||||
|
database_url = (
|
||||||
|
f"postgresql+asyncpg://"
|
||||||
|
f"{PG_LOGIN}:{PG_PASSWORD}@"
|
||||||
|
f"{PG_HOST}:{PG_PORT}/{PG_DATABASE}"
|
||||||
|
)
|
||||||
|
|
||||||
engine = create_async_engine(
|
engine = create_async_engine(
|
||||||
database_url,
|
database_url,
|
||||||
pool_timeout=2000,
|
pool_timeout=2000,
|
||||||
|
pool_size=10,
|
||||||
pool_pre_ping=True,
|
pool_pre_ping=True,
|
||||||
)
|
)
|
||||||
session_factory = async_sessionmaker(
|
session_factory = async_sessionmaker(
|
||||||
|
|||||||
Reference in New Issue
Block a user