alembic env.py supports env var DEXORDER_DB_URL
This commit is contained in:
@@ -20,7 +20,13 @@ from sys import path
|
|||||||
path.append('src')
|
path.append('src')
|
||||||
import dexorder.database.model
|
import dexorder.database.model
|
||||||
target_metadata = dexorder.database.model.Base.metadata
|
target_metadata = dexorder.database.model.Base.metadata
|
||||||
if not config.get_main_option('sqlalchemy.url'):
|
|
||||||
|
import os
|
||||||
|
# Retrieve the database URL from the environment variable. We do not do a full load of
|
||||||
|
db_url_env = os.getenv('DEXORDER_DB_URL')
|
||||||
|
if db_url_env:
|
||||||
|
config.set_main_option('sqlalchemy.url', db_url_env)
|
||||||
|
elif not config.get_main_option('sqlalchemy.url'):
|
||||||
config.set_main_option('sqlalchemy.url', dexorder.config.db_url)
|
config.set_main_option('sqlalchemy.url', dexorder.config.db_url)
|
||||||
|
|
||||||
# other values from the config, defined by the needs of env.py,
|
# other values from the config, defined by the needs of env.py,
|
||||||
|
|||||||
Reference in New Issue
Block a user