diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-01 18:06:25 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-01 18:06:25 +0900 |
| commit | 7c05359bccfa0ca50a8f55c1a99cfadd731c8e89 (patch) | |
| tree | e6d182f6ce6c32b6d53aefa5d2cd7677e154e3eb /shared/alembic | |
| parent | 1270e5edfa8e00ec6306e0921c54d5c130a01b54 (diff) | |
fix: resolve final 3 issues for production readiness
- Fix API strategies endpoint path resolution (use STRATEGIES_DIR env var)
- Add DATABASE_URL env var override in alembic env.py
- Move risk config fields to shared Settings base class
- Remove duplicate fields from ExecutorConfig
Diffstat (limited to 'shared/alembic')
| -rw-r--r-- | shared/alembic/env.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/shared/alembic/env.py b/shared/alembic/env.py index 14303f6..18687f2 100644 --- a/shared/alembic/env.py +++ b/shared/alembic/env.py @@ -1,6 +1,7 @@ """Alembic environment configuration for async PostgreSQL migrations.""" import asyncio +import os from logging.config import fileConfig from alembic import context @@ -14,6 +15,13 @@ config = context.config if config.config_file_name is not None: fileConfig(config.config_file_name) +# Override URL from DATABASE_URL env var if set +database_url = os.environ.get("DATABASE_URL") +if database_url: + if database_url.startswith("postgresql://"): + database_url = database_url.replace("postgresql://", "postgresql+asyncpg://", 1) + config.set_main_option("sqlalchemy.url", database_url) + target_metadata = Base.metadata |
