Skip to content
This repository was archived by the owner on Jul 14, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ export const buildCmd = (): Command => {
.option("-n, --name <name>", "Location name")
.option("-u, --username <username>", "Proxy user")
.option("-p, --password <password>", "Proxy password")
.option("-l, --host-network", "Use host network (default: false). If set you can use localhost directly", false)
.action(startPrivateLocationWorker);

program.command("stop-private-location")
Expand Down
16 changes: 13 additions & 3 deletions src/plw/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,17 @@ const createDockerCommand = (options: {
name?: string;
username?: string;
password?: string;
hostNetwork?: boolean;
}): string => {
return `docker run --rm --name PLW -e PLW_NAME=${options.name} -e PROXY_USER=${options.username} -e PROXY_PASS=${options.password} -e APIKEY=${options.apiKey} eu.gcr.io/octomind-dev/plw:latest`;
return `docker run --rm --name PLW ${options.hostNetwork ? "--network host" : ""} -e PLW_NAME=${options.name} -e PROXY_USER=${options.username} -e PROXY_PASS=${options.password} -e APIKEY=${options.apiKey} eu.gcr.io/octomind-dev/plw:latest`;
};

export const startPrivateLocationWorker = async (options: {
name?: string;
username?: string;
password?: string;
apikey: string;
hostNetwork?: boolean;
}) => {
const name = options.name || "default-plw";
const username = options.username || randomUUID().replace(/-/g, "");
Expand All @@ -99,7 +101,13 @@ export const startPrivateLocationWorker = async (options: {
"API key is required. Please configure it first by running 'octomind init'",
);
}
const command = createDockerCommand({ name, username, password, apiKey });
const command = createDockerCommand({
name,
username,
password,
apiKey,
hostNetwork: options.hostNetwork,
});

if (!(await checkDockerDaemon())) {
console.error(
Expand All @@ -108,7 +116,9 @@ export const startPrivateLocationWorker = async (options: {
return;
}

console.log(`executing command : '${command}'`);
console.log(
`executing command : '${command.replace(/APIKEY=[^\s&]*/g, "APIKEY=***")}'`,
);
const args = command.split(" ");
const result = await spawnAndStreamLines(args[0], args.slice(1), 10);
console.log(`Captured ${result.lines.length} lines`);
Expand Down