Adds prettier 3.9.8 (exact) with a shared config (single quotes, 120 columns, trailing commas), .prettierignore, .editorconfig and the `format` / `format:check` scripts, then formats all TypeScript, JavaScript, CSS, JSON and YAML sources. Purely mechanical: no behaviour change. Typecheck passes, the vitest suite and the 74 IDE node tests produce the same results as before (socket-binding tests still cannot run inside this sandbox). Previously the longest source line was ~3000 characters; reviewing the following semantic changes now produces readable diffs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.4 KiB
JavaScript
31 lines
1.4 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);
|
|
});
|