Imports the previously untracked working tree as-is so that the review changes that follow (requirements -> design -> implementation) can be reviewed as diffs and reverted if needed. No content changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
19 lines
1.3 KiB
JavaScript
19 lines
1.3 KiB
JavaScript
import { createGateway } from './server.mjs';
|
|
import { readFileSync } from 'node:fs';
|
|
|
|
const production = process.env.NODE_ENV === 'production';
|
|
const publicUrl = process.env.WF_IDE_PUBLIC_URL ?? 'http://127.0.0.1:4400';
|
|
if (production && !publicUrl.startsWith('https://')) throw new Error('Production gateway requires HTTPS public URL');
|
|
const gateway = createGateway({
|
|
publicUrl,
|
|
apiOrigin: process.env.WF_API_URL ?? 'http://127.0.0.1:4000',
|
|
tenantId: process.env.WF_TENANT_ID ?? 'demo',
|
|
serviceToken: process.env.WF_WORKSPACE_GATEWAY_TOKEN,
|
|
allowedUpstreamOrigins: (process.env.WF_IDE_ALLOWED_UPSTREAM_ORIGINS ?? (production ? '' : 'http://127.0.0.1:4300')).split(',').filter(Boolean),
|
|
allowedServiceNamespace: process.env.WF_IDE_ALLOWED_SERVICE_NAMESPACE,
|
|
allowedCollaborationOrigins: (process.env.WF_COLLABORATION_ALLOWED_UPSTREAM_ORIGINS ?? '').split(',').filter(Boolean),
|
|
assertionPrivateKey: process.env.WF_IDE_GATEWAY_PRIVATE_KEY_FILE ? readFileSync(process.env.WF_IDE_GATEWAY_PRIVATE_KEY_FILE, 'utf8') : undefined,
|
|
});
|
|
gateway.server.listen(Number(process.env.WF_IDE_GATEWAY_PORT ?? 4400), process.env.WF_IDE_GATEWAY_HOST ?? '127.0.0.1', () => console.log(`Workspace gateway listening at ${publicUrl}`));
|
|
for (const signal of ['SIGTERM', 'SIGINT']) process.on(signal, async () => { await gateway.close(); process.exit(0); });
|