Better Docker support #277
|
@ -530,5 +530,12 @@ class Config:
|
|||
# pylint: disable=protected-access
|
||||
cls._get_instance()._config[key] = value
|
||||
|
||||
@classmethod
|
||||
def get_file(cls) -> str:
|
||||
"""
|
||||
:return: The main configuration file path.
|
||||
"""
|
||||
return cls._get_instance().config_file
|
||||
|
||||
|
||||
# vim:sw=4:ts=4:et:
|
||||
|
|
|
@ -29,6 +29,7 @@ from sqlalchemy.orm import ColumnProperty, backref, relationship
|
|||
from sqlalchemy.orm.exc import ObjectDeletedError
|
||||
|
||||
import platypush
|
||||
from platypush.config import Config
|
||||
from platypush.common.db import Base
|
||||
from platypush.message import JSONAble, Message
|
||||
|
||||
|
@ -355,6 +356,8 @@ def run_db_migrations():
|
|||
'-c',
|
||||
alembic_ini,
|
||||
'-x',
|
||||
f'CFGFILE={Config.get_file()}',
|
||||
'-x',
|
||||
f'DBNAME={_get_db_engine().url}',
|
||||
'upgrade',
|
||||
'head',
|
||||
|
|
|
@ -74,6 +74,10 @@ def run_migrations_online() -> None:
|
|||
|
||||
|
||||
def set_db_engine():
|
||||
app_conf_file = context.get_x_argument(as_dictionary=True).get('CFGFILE')
|
||||
if app_conf_file:
|
||||
Config.init(app_conf_file)
|
||||
|
||||
engine_url = context.get_x_argument(as_dictionary=True).get('DBNAME')
|
||||
if not engine_url:
|
||||
db_conf = Config.get('db')
|
||||
|
|
Loading…
Reference in New Issue