mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-23 08:00:45 +00:00
a4b440a20d
When a worktree runs inside a Docker sandbox, its ports are only reachable via the container's bridge IP. socat forwards host ports to the container so the browser (over SSH) can reach them. - New socat.ts module manages forwarding lifecycle (start/stop/reconcile) - Polls for container after creation (non-blocking, up to 30s) - Kills orphaned socat on startup before re-establishing forwards - Cleans up on worktree removal and SIGINT/SIGTERM - Extract readEnvLocal to env.ts to break circular import - Change isPortListening to HTTP fetch (avoids socat false positives) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
16 lines
527 B
TypeScript
16 lines
527 B
TypeScript
/** Read key=value pairs from a worktree's .env.local file. */
|
|
export function readEnvLocal(wtDir: string): Record<string, string> {
|
|
try {
|
|
const content = Bun.spawnSync(["cat", `${wtDir}/.env.local`], { stdout: "pipe" });
|
|
const text = new TextDecoder().decode(content.stdout).trim();
|
|
const env: Record<string, string> = {};
|
|
for (const line of text.split("\n")) {
|
|
const match = line.match(/^(\w+)=(.*)$/);
|
|
if (match) env[match[1]] = match[2];
|
|
}
|
|
return env;
|
|
} catch {
|
|
return {};
|
|
}
|
|
}
|