Backend (src/server, runs on Bun): - GibbzHttpServer (health, /api/ice, /api/rooms, static, keepalive tuning) - SignalingServer with Peer/Room/RoomRegistry classes and typed messages - IceConfigProvider (env STUN/TURN + coturn HMAC ephemeral creds) - StaticFileServer (dist/ with public/ fallback, traversal guard) - Tracing (OpenTelemetry SDK), AppConfig; createApp() factory for tests Frontend (src/client, built by Vite): - VoiceApp orchestrator implementing VoiceAppContext - WebRtcManager + PeerSession (perfect negotiation, pc rebuild, quality monitor) - SignalingClient + ReconnectController, AudioManager, SpatialAudio, Microphone/ScreenShare controllers, ScreensUi/RosterUi/SpatialMap/ SpeakingMonitor, Settings/Welcome dialogs, LayoutManager, MatrixChat Tooling: bun scripts (dev/start/test/typecheck), vite.config.ts root src/client with publicDir public/static, vitest-config for CI-less runs, bun-based Dockerfile (oven/bun:1), Makefile + README updated, legacy server.js/tracing.js/test.js/public js removed. Verified locally: tsc --noEmit clean, vitest run 6/6 green, vite build ok, server smoke-tested serving dist + signaling endpoints under Node. Local bun binary segfaults (SIGILL) on this host, so 'bun test' itself was not executable here; tests are vitest-API compatible which bun test maps.
22 lines
675 B
TypeScript
22 lines
675 B
TypeScript
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
|
|
/**
|
|
* Runtime configuration resolved from the environment.
|
|
*
|
|
* The static directory prefers the Vite production build (`dist/`) and falls
|
|
* back to `public/` so a dev-mode server never 404s outright.
|
|
*/
|
|
export class AppConfig {
|
|
readonly port: number;
|
|
readonly host: string;
|
|
readonly staticDir: string;
|
|
|
|
constructor(env: Record<string, string | undefined> = process.env, cwd: string = process.cwd()) {
|
|
this.port = Number(env.PORT || 8080);
|
|
this.host = env.HOST || '0.0.0.0';
|
|
const dist = path.join(cwd, 'dist');
|
|
this.staticDir = fs.existsSync(dist) ? dist : path.join(cwd, 'public');
|
|
}
|
|
}
|