Skip to content

Commit 61bc5f7

Browse files
committed
fix: streamline deploy button configuration
Avoid prompting for optional default provider credentials, generate JWT secrets during deployment, and expose the Artifacts beta feature flag.
1 parent bfb5643 commit 61bc5f7

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

.dev.vars.example

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
#ENVIRONMENT="prod" # Options: dev, staging, prod
44

55
# Feature flags
6-
# Cloudflare Artifacts filesystem backend for SpaceDO (closed beta). Disabled
7-
# unless set to "true". In deployed environments this is managed from the
8-
# Cloudflare dashboard (not committed); set it here only for local dev.
9-
#ENABLE_ARTIFACTS="true"
6+
# Cloudflare Artifacts filesystem backend for SpaceDO. This feature is in closed beta;
7+
# enable it only if Cloudflare has granted your account access.
8+
ENABLE_ARTIFACTS="false"
109

1110
# Cloudflare Credentials (Required for manual deployment via `bun run deploy`)
1211
# These are automatically provided when using "Deploy to Cloudflare" button
@@ -20,7 +19,7 @@
2019
# Provider specific secrets:
2120
#ANTHROPIC_API_KEY=""
2221
#OPENAI_API_KEY=""
23-
GOOGLE_AI_STUDIO_API_KEY=""
22+
#GOOGLE_AI_STUDIO_API_KEY=""
2423
#OPENROUTER_API_KEY="default"
2524
#GROQ_API_KEY="default"
2625

@@ -37,7 +36,8 @@ GOOGLE_AI_STUDIO_API_KEY=""
3736
# GITHUB_EXPORTER_CLIENT_ID=""
3837

3938
# Secrets for various internal services of this platform
40-
JWT_SECRET=""
39+
# JWT_SECRET is generated automatically during Deploy to Cloudflare.
40+
#JWT_SECRET=""
4141

4242
# AI Gateway URL Override (Leave as-is if not going to set it)
4343
#CLOUDFLARE_AI_GATEWAY_URL=""

scripts/deploy.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515

1616
import { execSync } from 'child_process';
17+
import { randomBytes } from 'crypto';
1718
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
1819
import { join, dirname } from 'path';
1920
import { fileURLToPath } from 'url';
@@ -1770,6 +1771,7 @@ class CloudflareDeploymentManager {
17701771
'JWT_SECRET',
17711772
'SENTRY_DSN',
17721773
'AI_PROXY_JWT_SECRET',
1774+
'ENABLE_ARTIFACTS',
17731775
'MAX_SANDBOX_INSTANCES',
17741776
'CUSTOM_DOMAIN',
17751777
'CUSTOM_PREVIEW_DOMAIN',
@@ -1779,6 +1781,11 @@ class CloudflareDeploymentManager {
17791781
'PLATFORM_MODEL_PROVIDERS',
17801782
];
17811783

1784+
const generatedJwtSecret = process.env.JWT_SECRET ? undefined : randomBytes(64).toString('base64url');
1785+
if (generatedJwtSecret) {
1786+
console.log('🔐 Generated JWT_SECRET for this deployment');
1787+
}
1788+
17821789
const prodVarsContent: string[] = [
17831790
'# Production environment variables for Cloudflare Orange Build',
17841791
'# Generated automatically during deployment',
@@ -1788,7 +1795,7 @@ class CloudflareDeploymentManager {
17881795

17891796
// Add environment variables that are set
17901797
secretVars.forEach((varName) => {
1791-
let value = process.env[varName];
1798+
let value = varName === 'JWT_SECRET' ? generatedJwtSecret : process.env[varName];
17921799

17931800
// Apply fallback logic for CLOUDFLARE_AI_GATEWAY_TOKEN
17941801
if (varName === 'CLOUDFLARE_AI_GATEWAY_TOKEN' && (!value || value === '')) {

0 commit comments

Comments
 (0)