Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Add possibility to specify team id when building a new template in CLI

Jakub Novak461286caf0bf
diff --git a/packages/cli/src/commands/template/build.ts b/packages/cli/src/commands/template/build.ts
index 663c94acc..7b6837b24 100644
--- a/packages/cli/src/commands/template/build.ts
+++ b/packages/cli/src/commands/template/build.ts
@@ -88,6 +88,10 @@ export const buildCommand = new commander.Command('build')
'-c, --cmd <start-command>',
'specify command that will be executed when the sandbox is started.',
)
+ .option(
+ '-t, --team <team-id>',
+ 'specify the team ID that the sandbox template will be associated with. You can find it in the team settings in the E2B dashboard.',
+ )
.addOption(configOption)
.option(
'--cpu-count <cpu-count>',
@@ -112,6 +116,7 @@ export const buildCommand = new commander.Command('build')
dockerfile?: string
name?: string
cmd?: string
+ team?: string
config?: string
cpuCount?: number
memoryMb?: number
@@ -152,6 +157,7 @@ export const buildCommand = new commander.Command('build')
let startCmd = opts.cmd
let cpuCount = opts.cpuCount
let memoryMB = opts.memoryMb
+ let teamID = opts.team
const root = getRoot(opts.path)
const configPath = getConfigPath(root, opts.config)
@@ -179,6 +185,7 @@ export const buildCommand = new commander.Command('build')
startCmd = opts.cmd || config.start_cmd
cpuCount = opts.cpuCount || config.cpu_count
memoryMB = opts.memoryMb || config.memory_mb
+ teamID = opts.team || config.team_id
}
if (config && templateID && config.template_id !== templateID) {
@@ -219,6 +226,7 @@ export const buildCommand = new commander.Command('build')
cpuCount: cpuCount,
memoryMB: memoryMB,
dockerfile: dockerfileContent,
+ teamID: teamID,
}
if (opts.memoryMb) {
@@ -256,6 +264,7 @@ export const buildCommand = new commander.Command('build')
start_cmd: startCmd,
cpu_count: cpuCount,
memory_mb: memoryMB,
+ team_id: teamID,
},
true,
)
diff --git a/packages/cli/src/config/index.ts b/packages/cli/src/config/index.ts
index 25a1dec04..84fec54df 100644
--- a/packages/cli/src/config/index.ts
+++ b/packages/cli/src/config/index.ts
@@ -34,6 +34,7 @@ export const configSchema = yup.object({
start_cmd: yup.string().optional(),
cpu_count: yup.number().integer().min(1).optional(),
memory_mb: yup.number().integer().min(128).optional(),
+ team_id: yup.string().optional(),
})
export type E2BConfig = yup.InferType<typeof configSchema>