fix(telegram): propagate extra base_url config

This commit is contained in:
LeonSGP43 2026-05-15 21:31:02 +08:00 committed by Teknium
parent e7a3e9934f
commit 434d508d0a
2 changed files with 26 additions and 0 deletions

View file

@ -1062,6 +1062,12 @@ def load_gateway_config() -> GatewayConfig:
extra = {}
plat_data["extra"] = extra
extra[_telegram_extra_key] = telegram_cfg[_telegram_extra_key]
if _telegram_extra:
_plat_data, _plat_extra = _ensure_platform_extra_dict(
platforms_data, Platform.TELEGRAM.value
)
for _telegram_extra_key, _telegram_extra_value in _telegram_extra.items():
_plat_extra.setdefault(_telegram_extra_key, _telegram_extra_value)
whatsapp_cfg = yaml_cfg.get("whatsapp", {})
if isinstance(whatsapp_cfg, dict):

View file

@ -551,6 +551,26 @@ class TestLoadGatewayConfig:
assert config.platforms[Platform.TELEGRAM].extra["disable_link_previews"] is True
def test_bridges_telegram_extra_base_url_from_config_yaml(self, tmp_path, monkeypatch):
hermes_home = tmp_path / ".hermes"
hermes_home.mkdir()
config_path = hermes_home / "config.yaml"
config_path.write_text(
"telegram:\n"
" extra:\n"
" base_url: https://custom-proxy.example.com/bot\n",
encoding="utf-8",
)
monkeypatch.setenv("HERMES_HOME", str(hermes_home))
config = load_gateway_config()
assert (
config.platforms[Platform.TELEGRAM].extra["base_url"]
== "https://custom-proxy.example.com/bot"
)
def test_bridges_notice_delivery_from_config_yaml(self, tmp_path, monkeypatch):
hermes_home = tmp_path / ".hermes"
hermes_home.mkdir()