feat(network): add proxy support and docker host-gateway configuration

This commit is contained in:
mamad
2026-08-27 20:43:22 +03:30
parent 76a19131a6
commit 62af84c82e
6 changed files with 35 additions and 3 deletions
+2 -1
View File
@@ -6,6 +6,7 @@ from typing import Optional
from telethon import TelegramClient
from db.repository import Repository
from core.metrics import POSTS_PUBLISHED_TOTAL, QUEUE_POSTS_GAUGE
from core.proxy import get_telegram_proxy
logger = logging.getLogger(__name__)
@@ -26,7 +27,7 @@ class PublisherService:
self.bot_token = bot_token or os.getenv("BOT_TOKEN")
self.session_name = session_name or os.path.join(SESSION_DIR, "publisher.session")
os.makedirs(os.path.dirname(self.session_name), exist_ok=True)
self.client = TelegramClient(self.session_name, self.api_id, self.api_hash)
self.client = TelegramClient(self.session_name, self.api_id, self.api_hash, proxy=get_telegram_proxy())
self._running = False
self._task: Optional[asyncio.Task] = None