refactor: remove env var fallbacks

This commit is contained in:
banteg
2025-12-28 20:53:13 +04:00
parent 6338c9f635
commit 89ddf71e9c
6 changed files with 56 additions and 83 deletions
@@ -1,6 +1,5 @@
from __future__ import annotations
import os
import subprocess
import time
from typing import Optional
@@ -10,8 +9,7 @@ from bridge_common import (
RouteStore,
config_get,
load_telegram_config,
parse_allowed_chat_ids,
parse_chat_id_list,
resolve_chat_ids,
)
@@ -29,11 +27,9 @@ def tmux_send_text(target: str, text: str, press_enter: bool = True) -> None:
def main() -> None:
config = load_telegram_config()
token = os.environ.get("TELEGRAM_BOT_TOKEN") or config_get(config, "bot_token") or ""
db_path = os.environ.get("BRIDGE_DB") or config_get(config, "bridge_db") or "./bridge_routes.sqlite3"
allowed = parse_allowed_chat_ids(os.environ.get("ALLOWED_CHAT_IDS", ""))
if allowed is None:
allowed = parse_chat_id_list(config_get(config, "allowed_chat_ids"))
token = config_get(config, "bot_token") or ""
db_path = config_get(config, "bridge_db") or "./bridge_routes.sqlite3"
allowed = resolve_chat_ids(config)
bot = TelegramClient(token)
store = RouteStore(db_path)