From 1ae99199b25215e15c5c2a2c1721dd8eaa6c1409 Mon Sep 17 00:00:00 2001 From: RockChinQ Date: Thu, 2 Apr 2026 13:58:47 +0800 Subject: [PATCH] feat: support env var override for list config values List-type config values can now be set via environment variables using comma-separated strings. For example: SYSTEM__DISABLED_ADAPTERS=aiocqhttp,dingtalk Previously list and dict types were both skipped; now only dict is skipped. --- src/langbot/pkg/core/stages/load_config.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/langbot/pkg/core/stages/load_config.py b/src/langbot/pkg/core/stages/load_config.py index 707b62f6..26f4a9e1 100644 --- a/src/langbot/pkg/core/stages/load_config.py +++ b/src/langbot/pkg/core/stages/load_config.py @@ -80,8 +80,12 @@ def _apply_env_overrides_to_config(cfg: dict) -> dict: if i == len(keys) - 1: # At the final key if key in current: - if isinstance(current[key], (dict, list)): - # Skip dict and list types + if isinstance(current[key], list): + # Convert comma-separated string to list + # e.g., SYSTEM__DISABLED_ADAPTERS="aiocqhttp,dingtalk" + current[key] = [item.strip() for item in env_value.split(',') if item.strip()] + elif isinstance(current[key], dict): + # Skip dict types pass else: # Valid scalar value - convert and set it