wishforge-ide/scripts/provision-tenant.ts
eust-w 78ed117763 feat: make the deployment mode explicit and fail closed
Security-relevant behaviour (development tokens, loopback HTTP, inline
checkpoints, raw provider keys, optional verification profiles) was
keyed off NODE_ENV === 'production', so any deployment that forgot
NODE_ENV silently ran with development rules.

- @wishforge/contracts exports deploymentMode/isProduction/
  requireDeploymentMode. WF_DEPLOYMENT_MODE wins; misspelled values and
  development combined with NODE_ENV=production are rejected; NODE_ENV
  remains a fallback only for libraries and tests.
- All API, runtime, artifact, Git service and operator-script checks use
  isProduction.
- The API, worker, Git service and Runner refuse to start without an
  explicit WF_DEPLOYMENT_MODE; the IDE gateway treats anything other
  than an explicit development mode as production.
- The development seed loads .env.local before checking the mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 14:07:02 +08:00

10 lines
378 B
TypeScript

import { isProduction } from '@wishforge/contracts';
import { runTenantAdmin } from './tenant-admin.js';
if (!isProduction(process.env)) {
try {
process.loadEnvFile('.env.local');
} catch {}
}
// tenantId name region ownerSubject planId operatorSubject -- no arbitrary quota values.
console.log(JSON.stringify(await runTenantAdmin('provision', process.argv.slice(2))));