Parcourir la source

修改环境变量 VSCODE_HOST 自定义

mrh il y a 1 an
Parent
commit
d3f569f815
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3 1
      openhands/runtime/impl/docker/docker_runtime.py

+ 3 - 1
openhands/runtime/impl/docker/docker_runtime.py

@@ -1,5 +1,6 @@
 import atexit
 from functools import lru_cache
+import os
 from typing import Callable
 
 import docker
@@ -372,5 +373,6 @@ class DockerRuntime(ActionExecutionClient):
         token = super().get_vscode_token()
         if not token:
             return None
-        vscode_url = f'http://localhost:{self._host_port + 1}/?tkn={token}&folder={self.config.workspace_mount_path_in_sandbox}'
+        vscode_host = os.environ.get('VSCODE_HOST', "localhost")
+        vscode_url = f'http://{vscode_host}:{self._host_port + 1}/?tkn={token}&folder={self.config.workspace_mount_path_in_sandbox}'
         return vscode_url