The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.
TypeScript code-editorcross-platformdapdatabase-clientdebuggerdesktop-appdeveloper-toolsgithttp-clientideintellijlsprusttauriterminal
fix(remote): Docker run configurations take their environment from the remote host (#1098)
l0ng-ai1ed9275da098
diff --git a/Cargo.lock b/Cargo.lockindex 4d308c5d4..428910432 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -4244,6 +4244,7 @@ dependencies = ["ide-coverage","ide-dap","ide-db",+ "ide-docker","ide-extension","ide-http","ide-index",diff --git a/crates/ide-host/Cargo.toml b/crates/ide-host/Cargo.tomlindex e95aee036..5f7267d7d 100644--- a/crates/ide-host/Cargo.toml+++ b/crates/ide-host/Cargo.toml@@ -44,6 +44,7 @@ ide-notebook.workspace = trueide-extension.workspace = trueide-plugin.workspace = trueide-tools = { path = "../ide-tools" }+ide-docker = { path = "../ide-docker" }serde.workspace = trueserde_json.workspace = truetoml.workspace = truediff --git a/crates/ide-host/src/ops/docker.rs b/crates/ide-host/src/ops/docker.rsnew file mode 100644index 000000000..cea0289a5--- /dev/null+++ b/crates/ide-host/src/ops/docker.rs@@ -0,0 +1,17 @@+//! Docker run configurations: the environment their `docker` command line runs with.+use crate::Host;+use crate::rpc::Dispatcher;+use ide_core::IdeResult;+use ide_docker::DockerEndpoint;+use std::collections::BTreeMap;++/// The endpoint's variables plus a `PATH` that finds this host's `docker`. A remote project+/// gets them from the server, since its run configurations start on the remote host.+pub async fn run_env(host: &Host, endpoint: DockerEndpoint) -> IdeResult<BTreeMap<String, String>> {+ endpoint.validate()?;+ host.blocking(move || Ok(ide_docker::run_env(&endpoint))).await+}++pub(crate) fn register(d: &mut Dispatcher) {+ d.add("docker_run_env", |c| async move { run_env(&c.host, c.arg("endpoint")?).await });+}diff --git a/crates/ide-host/src/ops/mod.rs b/crates/ide-host/src/ops/mod.rsindex 9c020130b..98e92e1a0 100644--- a/crates/ide-host/src/ops/mod.rs+++ b/crates/ide-host/src/ops/mod.rs@@ -12,6 +12,7 @@ pub mod debug;pub mod dependencies;pub mod deploy;pub mod doc;+pub mod docker;pub mod env;pub mod fs;pub mod history;@@ -87,6 +88,7 @@ pub fn register_all(d: &mut crate::rpc::Dispatcher) {run::register(d);env::register(d);deploy::register(d);+ docker::register(d);db::register(d);}diff --git a/crates/ide-host/tests/rpc.rs b/crates/ide-host/tests/rpc.rsindex f0158ac36..fa0551082 100644--- a/crates/ide-host/tests/rpc.rs+++ b/crates/ide-host/tests/rpc.rs@@ -218,6 +218,13 @@ async fn serves_projects_files_documents_search_and_runs() {invoke(&peer, "vcs_init", json!({ "dir": project })).await.unwrap();until("git repository", || project.join(".git").is_dir()).await;+ // A Docker run configuration's environment comes from the host its command runs on.+ let env =+ invoke(&peer, "docker_run_env", json!({ "endpoint": { "kind": "socket", "path": "/run/user/1/docker.sock" } }))+ .await+ .unwrap();+ assert_eq!(env["DOCKER_HOST"], "unix:///run/user/1/docker.sock");+// Real project-host ignore writes travel through the remote command dispatcher.assert!(Dispatcher::standard().commands().contains(&"vcs_add_to_ignore"));let ignore_root = dunce::canonicalize(&project).unwrap();diff --git a/src-tauri/src/commands/docker.rs b/src-tauri/src/commands/docker.rsindex aecac0a7b..7d2dedfeb 100644--- a/src-tauri/src/commands/docker.rs+++ b/src-tauri/src/commands/docker.rs@@ -205,7 +205,9 @@ pub async fn docker_registry_login(/// daemon and puts the docker executable on `PATH`.#[tauri::command]#[specta::specta]-pub async fn docker_run_env(endpoint: DockerEndpoint) -> IdeResult<std::collections::BTreeMap<String, String>> {- endpoint.validate()?;- blocking(move || Ok(ide_docker::run_env(&endpoint))).await+pub async fn docker_run_env(+ state: State<'_, AppState>,+ endpoint: DockerEndpoint,+) -> IdeResult<std::collections::BTreeMap<String, String>> {+ ide_host::ops::docker::run_env(&state.host, endpoint).await}