Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Use configured team if no team is set in template build

Jakub Novak75b081b83558
diff --git a/.changeset/eleven-chefs-lick.md b/.changeset/eleven-chefs-lick.md
new file mode 100644
index 000000000..98dce9d43
--- /dev/null
+++ b/.changeset/eleven-chefs-lick.md
@@ -0,0 +1,5 @@
+---
+"@e2b/cli": patch
+---
+
+Use set team if no team is provided for template build
diff --git a/packages/cli/src/api.ts b/packages/cli/src/api.ts
index e8530630c..362799041 100644
--- a/packages/cli/src/api.ts
+++ b/packages/cli/src/api.ts
@@ -1,7 +1,7 @@
import * as boxen from 'boxen'
import * as e2b from 'e2b'
-import { getUserConfig } from './user'
+import { getUserConfig, UserConfig } from './user'
import { asBold, asPrimary } from './utils/format'
export let apiKey = process.env.E2B_API_KEY
@@ -37,13 +37,13 @@ export function ensureAPIKey() {
}
}
-export function ensureUserConfig() {
- const userConfig = getUserConfig()
- if (!userConfig) {
- console.error('No user config found, run `e2b auth login` to log in first.')
- process.exit(1)
- }
- return userConfig
+export function ensureUserConfig(): UserConfig {
+ const userConfig = getUserConfig()
+ if (!userConfig) {
+ console.error('No user config found, run `e2b auth login` to log in first.')
+ process.exit(1)
+ }
+ return userConfig
}
export function ensureAccessToken() {
diff --git a/packages/cli/src/commands/template/build.ts b/packages/cli/src/commands/template/build.ts
index f4f66bc3d..74fdb766d 100644
--- a/packages/cli/src/commands/template/build.ts
+++ b/packages/cli/src/commands/template/build.ts
@@ -6,7 +6,7 @@ import * as stripAnsi from 'strip-ansi'
import * as boxen from 'boxen'
import commandExists from 'command-exists'
import { wait } from 'src/utils/wait'
-import { ensureAccessToken } from 'src/api'
+import { ensureAccessToken, ensureUserConfig } from 'src/api'
import { getRoot } from 'src/utils/filesystem'
import {
asBold,
@@ -138,6 +138,8 @@ export const buildCommand = new commander.Command('build')
}
const accessToken = ensureAccessToken()
+ const userConfig = ensureUserConfig()
+
process.stdout.write('\n')
const newName = opts.name?.trim()
@@ -184,6 +186,7 @@ export const buildCommand = new commander.Command('build')
memoryMB = opts.memoryMb || config.memory_mb
teamID = opts.team || config.team_id
}
+ teamID = teamID || userConfig.teamId
if (config && templateID && config.template_id !== templateID) {
// error: you can't specify different ID than the one in config