diff --git a/packages/plugin-runtime/src/index.ts b/packages/plugin-runtime/src/index.ts index e2c08afc..d6c0c626 100644 --- a/packages/plugin-runtime/src/index.ts +++ b/packages/plugin-runtime/src/index.ts @@ -8,10 +8,15 @@ if (!port) { throw new Error('Plugin runtime missing PORT') } +const host = process.env.HOST; +if (!host) { + throw new Error('Plugin runtime missing HOST') +} + const pluginToAppEvents = new EventChannel(); const plugins: Record = {}; -const ws = new WebSocket(`ws://localhost:${port}`); +const ws = new WebSocket(`ws://${host}:${port}`); ws.on('message', async (e: Buffer) => { try { diff --git a/src-tauri/yaak-plugins/src/nodejs.rs b/src-tauri/yaak-plugins/src/nodejs.rs index 0a048074..cd706b8c 100644 --- a/src-tauri/yaak-plugins/src/nodejs.rs +++ b/src-tauri/yaak-plugins/src/nodejs.rs @@ -24,6 +24,7 @@ pub async fn start_nodejs_plugin_runtime( let cmd = app .shell() .sidecar("yaaknode")? + .env("HOST", addr.ip().to_string()) .env("PORT", addr.port().to_string()) .args(&[&plugin_runtime_main]);