summaryrefslogtreecommitdiff
path: root/packages/cli/src/utils/sandbox.ts
diff options
context:
space:
mode:
authorMark McDonald <[email protected]>2025-06-16 10:55:13 +0800
committerGitHub <[email protected]>2025-06-16 02:55:13 +0000
commitffc48b16d4aa6ba62f4b604b7b4cac8cf483442a (patch)
tree6da87b0ef10e2c7f6b385d27f507d7f80b27b71c /packages/cli/src/utils/sandbox.ts
parenta6c16ab08df86b2777b8e793a08e997feb4419a4 (diff)
Add Vertex env vars to sandbox (#1005)
Co-authored-by: Scott Densmore <[email protected]>
Diffstat (limited to 'packages/cli/src/utils/sandbox.ts')
-rw-r--r--packages/cli/src/utils/sandbox.ts45
1 files changed, 45 insertions, 0 deletions
diff --git a/packages/cli/src/utils/sandbox.ts b/packages/cli/src/utils/sandbox.ts
index 12fb6629..46ede9f8 100644
--- a/packages/cli/src/utils/sandbox.ts
+++ b/packages/cli/src/utils/sandbox.ts
@@ -443,6 +443,27 @@ export async function start_sandbox(sandbox: string) {
// mount os.tmpdir() as os.tmpdir() inside container
args.push('--volume', `${os.tmpdir()}:${getContainerPath(os.tmpdir())}`);
+ // mount gcloud config directory if it exists
+ const gcloudConfigDir = path.join(os.homedir(), '.config', 'gcloud');
+ if (fs.existsSync(gcloudConfigDir)) {
+ args.push(
+ '--volume',
+ `${gcloudConfigDir}:${getContainerPath(gcloudConfigDir)}:ro`,
+ );
+ }
+
+ // mount ADC file if GOOGLE_APPLICATION_CREDENTIALS is set
+ if (process.env.GOOGLE_APPLICATION_CREDENTIALS) {
+ const adcFile = process.env.GOOGLE_APPLICATION_CREDENTIALS;
+ if (fs.existsSync(adcFile)) {
+ args.push('--volume', `${adcFile}:${getContainerPath(adcFile)}:ro`);
+ args.push(
+ '--env',
+ `GOOGLE_APPLICATION_CREDENTIALS=${getContainerPath(adcFile)}`,
+ );
+ }
+ }
+
// mount paths listed in SANDBOX_MOUNTS
if (process.env.SANDBOX_MOUNTS) {
for (let mount of process.env.SANDBOX_MOUNTS.split(',')) {
@@ -540,6 +561,30 @@ export async function start_sandbox(sandbox: string) {
args.push('--env', `GOOGLE_API_KEY=${process.env.GOOGLE_API_KEY}`);
}
+ // copy GOOGLE_GENAI_USE_VERTEXAI
+ if (process.env.GOOGLE_GENAI_USE_VERTEXAI) {
+ args.push(
+ '--env',
+ `GOOGLE_GENAI_USE_VERTEXAI=${process.env.GOOGLE_GENAI_USE_VERTEXAI}`,
+ );
+ }
+
+ // copy GOOGLE_CLOUD_PROJECT
+ if (process.env.GOOGLE_CLOUD_PROJECT) {
+ args.push(
+ '--env',
+ `GOOGLE_CLOUD_PROJECT=${process.env.GOOGLE_CLOUD_PROJECT}`,
+ );
+ }
+
+ // copy GOOGLE_CLOUD_LOCATION
+ if (process.env.GOOGLE_CLOUD_LOCATION) {
+ args.push(
+ '--env',
+ `GOOGLE_CLOUD_LOCATION=${process.env.GOOGLE_CLOUD_LOCATION}`,
+ );
+ }
+
// copy GEMINI_MODEL
if (process.env.GEMINI_MODEL) {
args.push('--env', `GEMINI_MODEL=${process.env.GEMINI_MODEL}`);