pep-8 naming stuff.

Signed-off-by: Cliff Hill <xlorep@darkhelm.org>
This commit is contained in:
2025-08-22 23:57:09 -04:00
parent a1a435c7c1
commit fa6e3470b0
2 changed files with 11 additions and 11 deletions

View File

@@ -9,7 +9,7 @@ from sqlalchemy import Connection
from sqlalchemy import pool
from sqlalchemy.ext.asyncio import async_engine_from_config
from backend.db import db_url
from backend.db import DB_URL
from backend.models import Base
@@ -36,7 +36,7 @@ def run_migrations_offline():
script output.
"""
# url = config.get_main_option("sqlalchemy.url")
url = db_url
url = DB_URL
context.configure(
url=url,
target_metadata=target_metadata,
@@ -63,7 +63,7 @@ async def run_migrations_online():
and associate a connection with the context.
"""
configuration = cast(dict[str, str], config.get_section(config.config_ini_section))
configuration["sqlalchemy.url"] = db_url
configuration["sqlalchemy.url"] = DB_URL
connectable = async_engine_from_config(
configuration,
prefix="sqlalchemy.",

View File

@@ -6,15 +6,15 @@ from backend import config
# Database URL configuration
pg_user = config("POSTGRES_USER", default="user")
pg_password = config("POSTGRES_PASSWORD", default="password")
pg_db = config("POSTGRES_DB", default="mydb")
pg_host = config("POSTGRES_HOST", default="postgres")
pg_port = config("POSTGRES_PORT", default="5432")
db_url = f"postgresql+asyncpg://{pg_user}:{pg_password}@{pg_host}:{pg_port}/{pg_db}"
PG_USER = config("POSTGRES_USER", default="user")
PG_PASSWORD = config("POSTGRES_PASSWORD", default="password")
PG_DB = config("POSTGRES_DB", default="mydb")
PG_HOST = config("POSTGRES_HOST", default="postgres")
PG_PORT = config("POSTGRES_PORT", default="5432")
DB_URL = f"postgresql+asyncpg://{PG_USER}:{PG_PASSWORD}@{PG_HOST}:{PG_PORT}/{PG_DB}"
# Set the echo parameter based on the environment, other environments can be added as needed
echo = config("ENVIRONMENT", default="development") in {"development"}
ECHO = config("ENVIRONMENT", default="development") in {"development"}
# Create the async engine
engine = create_async_engine(db_url, echo=echo)
engine = create_async_engine(DB_URL, echo=ECHO)