fix(gateway): load platforms section from config.yaml into gateway config
The gateway config loader read config.yaml but never merged its `platforms` key into the runtime config dict. This meant that platform-specific settings defined under `platforms.<name>.extra` (e.g. webhook routes) were silently ignored unless the user also duplicated them in the legacy gateway.json file. Merge `yaml_cfg["platforms"]` into `gw_data["platforms"]` with a shallow deep-merge of the `extra` dict so that gateway.json defaults are preserved while config.yaml values take precedence. Closes #2305
This commit is contained in:
parent
3ba6043c62
commit
1830db0476
1 changed files with 17 additions and 1 deletions
|
|
@ -455,11 +455,27 @@ def load_gateway_config() -> GatewayConfig:
|
||||||
"pair",
|
"pair",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Bridge per-platform settings from config.yaml into gw_data
|
# Merge platforms section from config.yaml into gw_data so that
|
||||||
|
# nested keys like platforms.webhook.extra.routes are loaded.
|
||||||
|
yaml_platforms = yaml_cfg.get("platforms")
|
||||||
platforms_data = gw_data.setdefault("platforms", {})
|
platforms_data = gw_data.setdefault("platforms", {})
|
||||||
if not isinstance(platforms_data, dict):
|
if not isinstance(platforms_data, dict):
|
||||||
platforms_data = {}
|
platforms_data = {}
|
||||||
gw_data["platforms"] = platforms_data
|
gw_data["platforms"] = platforms_data
|
||||||
|
if isinstance(yaml_platforms, dict):
|
||||||
|
for plat_name, plat_block in yaml_platforms.items():
|
||||||
|
if not isinstance(plat_block, dict):
|
||||||
|
continue
|
||||||
|
existing = platforms_data.get(plat_name, {})
|
||||||
|
if not isinstance(existing, dict):
|
||||||
|
existing = {}
|
||||||
|
# Deep-merge extra dicts so gateway.json defaults survive
|
||||||
|
merged_extra = {**existing.get("extra", {}), **plat_block.get("extra", {})}
|
||||||
|
merged = {**existing, **plat_block}
|
||||||
|
if merged_extra:
|
||||||
|
merged["extra"] = merged_extra
|
||||||
|
platforms_data[plat_name] = merged
|
||||||
|
gw_data["platforms"] = platforms_data
|
||||||
for plat in Platform:
|
for plat in Platform:
|
||||||
if plat == Platform.LOCAL:
|
if plat == Platform.LOCAL:
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue