File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed
Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 11from logging .config import fileConfig
2- import os
3-
42from sqlalchemy import engine_from_config , create_engine
53from sqlalchemy import pool
6-
4+ from src . config import settings
75from alembic import context
86
97# this is the Alembic Config object, which provides
2220
2321# map Alembic environment names to DB URLs
2422DB_URLS = {
25- "development" : os . getenv ( "DEV_DATABASE_URL" ) ,
26- "production" : os . getenv ( "PROD_DATABASE_URL" ) ,
27- "custom" : os . getenv ( "CUSTOM_DATABASE_URL" ) ,
23+ "development" : settings . dev_database_url ,
24+ "production" : settings . prod_database_url ,
25+ "custom" : settings . custom_database_url ,
2826}
2927
3028def get_url () -> str :
@@ -39,9 +37,8 @@ def get_url() -> str:
3937# can be acquired:
4038# my_important_option = config.get_main_option("my_important_option")
4139# ... etc.
42- from os import environ as env
4340def env_url ():
44- return env . get ( "CTI_POSTGRES_URL" )
41+ return settings . cti_postgres_url
4542
4643def run_migrations_offline () -> None :
4744 """Run migrations in 'offline' mode.
Original file line number Diff line number Diff line change @@ -20,6 +20,11 @@ class Settings(BaseSettings):
2020 cti_mongo_url : Optional [str ] = Field (validation_alias = "CTI_MONGO_URL" , default = None )
2121 cti_postgres_url : Optional [str ] = Field (validation_alias = "CTI_POSTGRES_URL" , default = None )
2222
23+ # Alembic / Migration Database URLs
24+ dev_database_url : Optional [str ] = Field (validation_alias = "DEV_DATABASE_URL" , default = None )
25+ prod_database_url : Optional [str ] = Field (validation_alias = "PROD_DATABASE_URL" , default = None )
26+ custom_database_url : Optional [str ] = Field (validation_alias = "CUSTOM_DATABASE_URL" , default = None )
27+
2328 # Canvas Variables, only required for Canvas specific-operations
2429 # NOTE: SIS ID's are needed for SIS operations, must be manually defined ahead of time
2530 # TODO: Rename CTI_ACCESS_TOKEN to CTI_CANVAS_TOKEN, improve clarity on token purpose and differentiate from server token
You can’t perform that action at this time.
0 commit comments