SANDBOX_PORTS env var (#204)

This commit is contained in:
Olcan
2025-04-28 15:44:17 -07:00
committed by GitHub
parent 57ceadb7d8
commit cd1ddcb4f1
2 changed files with 25 additions and 3 deletions

View File

@@ -203,6 +203,16 @@ async function start_sandbox(sandbox: string) {
nodeArgs.push(`--inspect-brk=0.0.0.0:${debugPort}`);
}
// open additional ports if SANDBOX_PORTS is set
if (process.env.SANDBOX_PORTS) {
for (let port of process.env.SANDBOX_PORTS.split(',')) {
if ((port = port.trim())) {
console.log(`SANDBOX_PORTS: ${port}`);
args.push('-p', `${port}:${port}`);
}
}
}
// append remaining args (image, node, node args, cli path, cli args)
args.push(image, 'node', ...nodeArgs, cliPath, ...process.argv.slice(2));