Skip to content
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
15 changes: 15 additions & 0 deletions src/commands/devbox/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface CreateOptions {
root?: boolean;
user?: string;
networkPolicy?: string;
tunnel?: string;
gateways?: string[];
output?: string;
}
Expand Down Expand Up @@ -139,6 +140,13 @@ export async function createDevbox(options: CreateOptions = {}) {
);
}

// Validate tunnel option
if (options.tunnel && !["open", "authenticated"].includes(options.tunnel)) {
outputError(
"Invalid tunnel mode. Must be either 'open' or 'authenticated'",
);
}

// Build launch parameters
const launchParameters: Record<string, unknown> = {};
if (options.resources) {
Expand Down Expand Up @@ -213,6 +221,13 @@ export async function createDevbox(options: CreateOptions = {}) {
createRequest.secrets = parseSecrets(options.secrets);
}

// Handle tunnel configuration
if (options.tunnel) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good but are we also going to update the devbox detail page(to show the tunnel) and then enable tunnels (if not enabled) and finally get a tunnel url given a port

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be a separate PR, also changing this will update the docs which will then generate you a new cli page in the docs repo if it's in source/docs

createRequest.tunnel = {
auth_mode: options.tunnel,
};
}

// Handle gateways
if (options.gateways && options.gateways.length > 0) {
createRequest.gateways = parseGateways(options.gateways);
Expand Down
4 changes: 4 additions & 0 deletions src/utils/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export function createProgram(): Command {
.option("--root", "Run as root")
.option("--user <user:uid>", "Run as this user (format: username:uid)")
.option("--network-policy <id>", "Network policy ID to apply")
.option(
"--tunnel <mode>",
"Tunnel authentication mode (open, authenticated)",
)
.option(
"--gateways <gateways...>",
"Gateway configurations (format: ENV_PREFIX=gateway_id_or_name,secret_id_or_name)",
Expand Down
Loading