From fa6e3470b0daf96805a7ffa9798edd757c57f0f7 Mon Sep 17 00:00:00 2001 From: Cliff Hill Date: Fri, 22 Aug 2025 23:57:09 -0400 Subject: [PATCH] pep-8 naming stuff. Signed-off-by: Cliff Hill --- backend/migrations/env.py | 6 +++--- backend/src/backend/db.py | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/backend/migrations/env.py b/backend/migrations/env.py index f2aed8fd..619c0018 100644 --- a/backend/migrations/env.py +++ b/backend/migrations/env.py @@ -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.", diff --git a/backend/src/backend/db.py b/backend/src/backend/db.py index bab15385..a9518b6f 100644 --- a/backend/src/backend/db.py +++ b/backend/src/backend/db.py @@ -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)