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>
25 lines
1.0 KiB
JavaScript
25 lines
1.0 KiB
JavaScript
import { readFile } from 'node:fs/promises';
|
|
import { createPreviewGateway } from './server.mjs';
|
|
const required = name => {
|
|
const value = process.env[name];
|
|
if (!value) throw new Error(`Unconfigured: ${name}`);
|
|
return value;
|
|
};
|
|
const gateway = createPreviewGateway({
|
|
tenantId: required('WF_PREVIEW_TENANT_ID'),
|
|
environmentId: required('WF_PREVIEW_ENVIRONMENT_ID'),
|
|
projectId: required('WF_PREVIEW_PROJECT_ID'),
|
|
publicOrigin: required('WF_PREVIEW_PUBLIC_ORIGIN'),
|
|
upstreamOrigin: required('WF_PREVIEW_UPSTREAM_ORIGIN'),
|
|
apiOrigin: required('WF_API_PUBLIC_URL'),
|
|
serviceToken: required('WF_PREVIEW_GATEWAY_TOKEN'),
|
|
proofPrivateKey: await readFile(required('WF_PREVIEW_PROOF_PRIVATE_KEY_FILE'), 'utf8'),
|
|
production: process.env.NODE_ENV === 'production',
|
|
});
|
|
gateway.server.listen(Number(process.env.PORT ?? 4460), process.env.HOST ?? '127.0.0.1', () =>
|
|
console.log('Private preview gateway started with fixed environment routing.'),
|
|
);
|
|
const close = () => void gateway.close();
|
|
process.once('SIGINT', close);
|
|
process.once('SIGTERM', close);
|