Better Docker support #277

Merged
blacklight merged 66 commits from 276/better-docker into master 2023-09-04 02:49:15 +02:00
3 changed files with 14 additions and 0 deletions
Showing only changes of commit a8255f3621 - Show all commits

View File

@ -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:

View File

@ -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',

View File

@ -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')