mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-07 22:36:02 +00:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user