File size: 1,036 Bytes
dd480ef | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | /**
* Scripts: Validate Environment
* Checks all required env vars before deployment
*/
const REQUIRED_SIMULATOR_VARS = [
'OPENAI_API_KEY',
'N8N_BASE_URL',
'N8N_API_KEY',
'INTERNAL_API_SECRET',
];
const REQUIRED_WORKER_SECRETS = [
'OPENAI_API_KEY',
'N8N_API_KEY',
'INTERNAL_API_SECRET',
];
let hasError = false;
console.log('[ValidateEnv] Checking Simulator service environment variables...');
for (const key of REQUIRED_SIMULATOR_VARS) {
if (!process.env[key]) {
console.error(` β Missing: ${key}`);
hasError = true;
} else {
console.log(` β ${key}`);
}
}
console.log('');
console.log('[ValidateEnv] Cloudflare Worker secrets (set via wrangler secret put):');
for (const key of REQUIRED_WORKER_SECRETS) {
console.log(` β wrangler secret put ${key}`);
}
if (hasError) {
console.error('\n[ValidateEnv] β Environment validation failed. Set missing variables before deploying.');
process.exit(1);
} else {
console.log('\n[ValidateEnv] β All environment variables present.');
}
|