Skip to content

Commit ee7a83f

Browse files
committed
feat: suppress AI Gateway token in CI and limit template deploy environment variables
1 parent a71e382 commit ee7a83f

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

scripts/deploy.ts

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,9 +531,13 @@ class CloudflareDeploymentManager {
531531
);
532532
console.log(` Token ID: ${tokenData.result.id}`);
533533
console.warn(
534-
'⚠️ Please save this token and add it to CLOUDFLARE_AI_GATEWAY_TOKEN:',
534+
'⚠️ Store this token securely and set CLOUDFLARE_AI_GATEWAY_TOKEN for future deployments.',
535535
);
536-
console.warn(` ${newToken}`);
536+
if (!process.env.CI) {
537+
console.warn(` ${newToken}`);
538+
} else {
539+
console.warn(' (Token value suppressed because CI=true)');
540+
}
537541

538542
// Initialize separate AI Gateway SDK instance
539543
this.aiGatewayCloudflare = new Cloudflare({
@@ -632,8 +636,29 @@ class CloudflareDeploymentManager {
632636
`🚀 Deploying templates to R2 bucket: ${templatesBucket.bucket_name}`,
633637
);
634638

635-
const deployEnv = {
636-
...process.env,
639+
const inheritedKeys = [
640+
'PATH',
641+
'HOME',
642+
'USER',
643+
'SHELL',
644+
'TMPDIR',
645+
'TMP',
646+
'TEMP',
647+
'LANG',
648+
'LC_ALL',
649+
'CI',
650+
'GITHUB_WORKSPACE',
651+
];
652+
const inheritedEnv: NodeJS.ProcessEnv = {};
653+
inheritedKeys.forEach((key) => {
654+
const value = process.env[key];
655+
if (value !== undefined) {
656+
inheritedEnv[key] = value;
657+
}
658+
});
659+
660+
const deployEnv: NodeJS.ProcessEnv = {
661+
...inheritedEnv,
637662
CLOUDFLARE_API_TOKEN: this.env.CLOUDFLARE_API_TOKEN,
638663
CLOUDFLARE_ACCOUNT_ID: this.env.CLOUDFLARE_ACCOUNT_ID,
639664
BUCKET_NAME: templatesBucket.bucket_name,

0 commit comments

Comments
 (0)