mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-09 14:57:59 -05:00
Fix environment variable casting for dict and list types (#8494)
Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
@@ -37,7 +37,7 @@ class SandboxConfig(BaseModel):
|
||||
Must be one of [1, 2, 4, 8]. Will only be used if the runtime is remote.
|
||||
enable_gpu: Whether to enable GPU.
|
||||
docker_runtime_kwargs: Additional keyword arguments to pass to the Docker runtime when running containers.
|
||||
This should be a JSON string that will be parsed into a dictionary.
|
||||
This should be a Python dictionary literal string that will be parsed into a dictionary.
|
||||
trusted_dirs: List of directories that can be trusted to run the OpenHands CLI.
|
||||
vscode_port: The port to use for VSCode. If None, a random port will be chosen.
|
||||
This is useful when deploying OpenHands in a remote machine where you need to expose a specific port.
|
||||
|
||||
@@ -91,7 +91,10 @@ def load_from_env(
|
||||
cast_value = str(value).lower() in ['true', '1']
|
||||
# parse dicts and lists like SANDBOX_RUNTIME_STARTUP_ENV_VARS and SANDBOX_RUNTIME_EXTRA_BUILD_ARGS │
|
||||
elif (
|
||||
get_origin(field_type) is dict or get_origin(field_type) is list
|
||||
get_origin(field_type) is dict
|
||||
or get_origin(field_type) is list
|
||||
or field_type is dict
|
||||
or field_type is list
|
||||
):
|
||||
cast_value = literal_eval(value)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user