Build 060.25: implement Production Runtime Integration
This commit is contained in:
@@ -5,7 +5,11 @@ from __future__ import annotations
|
||||
from aiogram import Bot, Dispatcher
|
||||
from aiogram.client.default import DefaultBotProperties
|
||||
|
||||
from src.bootstrap.application import ApplicationComposition
|
||||
from src.bootstrap.logging import setup_logging
|
||||
from src.bootstrap.trade_stream_runtime import (
|
||||
build_trade_stream_production_runtime,
|
||||
)
|
||||
from src.core.config import load_settings
|
||||
from src.notifications.targets import NotificationTargetRegistry
|
||||
from src.storage.schema import init_schema
|
||||
@@ -13,7 +17,7 @@ from src.telegram.routers import setup_routers
|
||||
from src.trading.journal.service import JournalService
|
||||
|
||||
|
||||
def create_app() -> tuple[Bot, Dispatcher]:
|
||||
def create_app() -> ApplicationComposition:
|
||||
settings = load_settings()
|
||||
|
||||
setup_logging(settings.log_level)
|
||||
@@ -37,18 +41,9 @@ def create_app() -> tuple[Bot, Dispatcher]:
|
||||
pass
|
||||
raise
|
||||
|
||||
try:
|
||||
journal.log_info(
|
||||
"app_started",
|
||||
"Приложение запущено",
|
||||
{
|
||||
"env": settings.app_env,
|
||||
"exchange_name": settings.exchange_name,
|
||||
"default_symbol": settings.default_symbol,
|
||||
},
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
trade_stream_runtime = (
|
||||
build_trade_stream_production_runtime(settings)
|
||||
)
|
||||
|
||||
bot = Bot(
|
||||
token=settings.bot_token,
|
||||
@@ -61,4 +56,24 @@ def create_app() -> tuple[Bot, Dispatcher]:
|
||||
|
||||
setup_routers(dispatcher)
|
||||
|
||||
return bot, dispatcher
|
||||
try:
|
||||
journal.log_info(
|
||||
"app_started",
|
||||
"Приложение запущено",
|
||||
{
|
||||
"env": settings.app_env,
|
||||
"exchange_name": settings.exchange_name,
|
||||
"default_symbol": settings.default_symbol,
|
||||
"trade_stream_enabled": (
|
||||
settings.trade_stream.enabled
|
||||
),
|
||||
},
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return ApplicationComposition(
|
||||
bot=bot,
|
||||
dispatcher=dispatcher,
|
||||
trade_stream_runtime=trade_stream_runtime,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user