π OpenHands: AI-Driven Development
fix: adding support for environment variables type dict (#6672)
Fredy Sierra13839b427398
diff --git a/openhands/core/config/utils.py b/openhands/core/config/utils.pyindex 4fb7a5278b..b6bf4b77ab 100644--- a/openhands/core/config/utils.py+++ b/openhands/core/config/utils.py@@ -3,6 +3,7 @@ import osimport pathlibimport platformimport sys+from ast import literal_evalfrom types import UnionTypefrom typing import Any, MutableMapping, get_args, get_originfrom uuid import uuid4@@ -72,6 +73,9 @@ def load_from_env(cfg: AppConfig, env_or_toml_dict: dict | MutableMapping[str, s# Attempt to cast the env var to type hinted in the dataclassif field_type is bool:cast_value = str(value).lower() in ['true', '1']+ # parse dicts like SANDBOX_RUNTIME_STARTUP_ENV_VARS+ elif get_origin(field_type) is dict:+ cast_value = literal_eval(value)else:cast_value = field_type(value)setattr(sub_config, field_name, cast_value)