mirror of
https://github.com/reconurge/flowsint.git
synced 2026-04-30 11:19:07 -05:00
feat: remove env.py comments
This commit is contained in:
@@ -6,27 +6,21 @@ from sqlalchemy import engine_from_config, pool
|
|||||||
from alembic import context
|
from alembic import context
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
# Charger les variables d'environnement
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
# Permet les imports comme from flowsint_core.core.models.base import Base
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
|
||||||
|
|
||||||
# Importer Base et toutes les tables pour qu'Alembic les détecte
|
|
||||||
from flowsint_core.core.models import * # noqa
|
from flowsint_core.core.models import * # noqa
|
||||||
|
|
||||||
# Configuration Alembic
|
|
||||||
config = context.config
|
config = context.config
|
||||||
if config.config_file_name is not None:
|
if config.config_file_name is not None:
|
||||||
fileConfig(config.config_file_name)
|
fileConfig(config.config_file_name)
|
||||||
|
|
||||||
# Injecter l'URL de la BDD depuis le .env
|
|
||||||
database_url = os.getenv("DATABASE_URL")
|
database_url = os.getenv("DATABASE_URL")
|
||||||
if not database_url:
|
if not database_url:
|
||||||
raise RuntimeError("DATABASE_URL is not defined in .env")
|
raise RuntimeError("DATABASE_URL is not defined in .env")
|
||||||
config.set_main_option("sqlalchemy.url", database_url)
|
config.set_main_option("sqlalchemy.url", database_url)
|
||||||
|
|
||||||
# Définir la métadonnée cible pour autogenerate
|
|
||||||
target_metadata = Base.metadata
|
target_metadata = Base.metadata
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user