diff --git a/backend/alembic.ini b/backend/alembic.ini index a6c4612..1d141c2 100644 --- a/backend/alembic.ini +++ b/backend/alembic.ini @@ -86,7 +86,7 @@ path_separator = os # database URL. This is consumed by the user-maintained env.py script only. # other means of configuring database URLs may be customized within the env.py # file. -sqlalchemy.url = postgresql://wikitcg:password@localhost/wikitcg +sqlalchemy.url = placeholder [post_write_hooks] diff --git a/backend/alembic/env.py b/backend/alembic/env.py index 8363b51..ba288ef 100644 --- a/backend/alembic/env.py +++ b/backend/alembic/env.py @@ -6,6 +6,10 @@ from sqlalchemy import pool from alembic import context from models import Base +import os +from dotenv import load_dotenv +load_dotenv() + # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.config @@ -39,7 +43,7 @@ def run_migrations_offline() -> None: script output. """ - url = config.get_main_option("sqlalchemy.url") + url = config.get_main_option("sqlalchemy.url", os.environ["DATABASE_URL"]) context.configure( url=url, target_metadata=target_metadata,