Skip to content

Commit a3c1b7a

Browse files
authored
feat(devbox): add tunnel to devbox create (#99)
## Description <!-- Provide a brief description of your changes --> **Note:** PR titles should follow [Conventional Commits](https://www.conventionalcommits.org/) format (e.g., `feat(devbox): add support for custom env vars` or `fix(snapshot): resolve pagination issue`) as they are used for automatic release notes generation. ## Type of Change <!-- Mark the relevant option with an 'x' --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation update - [ ] Code refactoring - [ ] Performance improvement - [ ] Test updates ## Related Issues <!-- Link to related issues using #issue-number --> Closes # ## Changes Made <!-- Describe the changes in detail --> ## Testing <!-- Describe how you tested your changes --> - [ ] I have tested locally - [ ] I have added/updated tests - [ ] All existing tests pass ## Checklist - [ ] My code follows the code style of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have updated the documentation accordingly - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published ## Screenshots (if applicable) <!-- Add screenshots to help explain your changes --> ## Additional Notes <!-- Any additional information that reviewers should know -->
1 parent 441e888 commit a3c1b7a

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

src/commands/devbox/create.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ interface CreateOptions {
2323
root?: boolean;
2424
user?: string;
2525
networkPolicy?: string;
26+
tunnel?: string;
2627
gateways?: string[];
2728
output?: string;
2829
}
@@ -139,6 +140,13 @@ export async function createDevbox(options: CreateOptions = {}) {
139140
);
140141
}
141142

143+
// Validate tunnel option
144+
if (options.tunnel && !["open", "authenticated"].includes(options.tunnel)) {
145+
outputError(
146+
"Invalid tunnel mode. Must be either 'open' or 'authenticated'",
147+
);
148+
}
149+
142150
// Build launch parameters
143151
const launchParameters: Record<string, unknown> = {};
144152
if (options.resources) {
@@ -213,6 +221,13 @@ export async function createDevbox(options: CreateOptions = {}) {
213221
createRequest.secrets = parseSecrets(options.secrets);
214222
}
215223

224+
// Handle tunnel configuration
225+
if (options.tunnel) {
226+
createRequest.tunnel = {
227+
auth_mode: options.tunnel,
228+
};
229+
}
230+
216231
// Handle gateways
217232
if (options.gateways && options.gateways.length > 0) {
218233
createRequest.gateways = parseGateways(options.gateways);

src/utils/commands.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ export function createProgram(): Command {
5959
.option("--root", "Run as root")
6060
.option("--user <user:uid>", "Run as this user (format: username:uid)")
6161
.option("--network-policy <id>", "Network policy ID to apply")
62+
.option(
63+
"--tunnel <mode>",
64+
"Tunnel authentication mode (open, authenticated)",
65+
)
6266
.option(
6367
"--gateways <gateways...>",
6468
"Gateway configurations (format: ENV_PREFIX=gateway_id_or_name,secret_id_or_name)",

0 commit comments

Comments
 (0)