fix: enforce rollout gates across backend entry points

This commit is contained in:
jb
2026-09-19 10:01:23 -04:00
parent 92272d4e9a
commit 99436225f6
16 changed files with 115 additions and 23 deletions
+5 -3
View File
@@ -1,10 +1,12 @@
export {};
// Run only against your intended self-hosted deployment. Values are never printed.
const names = ['CONVEX_BRIDGE_SECRET', 'APP_AUTH_ISSUER', 'APP_AUTH_JWKS'] as const;
const requiredNames = ['CONVEX_BRIDGE_SECRET', 'APP_AUTH_ISSUER', 'APP_AUTH_JWKS', 'APP_CAPABILITY_ALLOWLIST'] as const;
if (!process.env.CONVEX_SELF_HOSTED_URL || !process.env.CONVEX_SELF_HOSTED_ADMIN_KEY) throw new Error('Set self-hosted URL and admin key before configuring Convex.');
for (const name of names) {
for (const name of requiredNames) {
const value = process.env[name];
if (!value) throw new Error(`Missing ${name}`);
if (value === undefined || (name !== 'APP_CAPABILITY_ALLOWLIST' && !value)) {
throw new Error(`Missing ${name}`);
}
// Pipe values rather than exposing them in process arguments or shell history.
const child = Bun.spawn(['bun', 'node_modules/convex/bin/main.js', 'env', 'set', name], { stdin: new Blob([value]), stdout: 'pipe', stderr: 'pipe' });
if (await child.exited !== 0) throw new Error(`Could not configure ${name}; check deployment URL/admin key (output suppressed to protect secrets).`);