Initial commit: Rondevu signaling server

Open signaling and tracking server for peer discovery in distributed P2P applications.

Features:
- REST API for WebRTC peer discovery and signaling
- Origin-based session isolation
- Multiple storage backends (SQLite, in-memory, Cloudflare KV)
- Docker and Cloudflare Workers deployment support
- Automatic session cleanup and expiration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-02 14:32:25 +01:00
commit 82c0e8b065
18 changed files with 3346 additions and 0 deletions

26
src/config.ts Normal file
View File

@@ -0,0 +1,26 @@
/**
* Application configuration
* Reads from environment variables with sensible defaults
*/
export interface Config {
port: number;
storageType: 'sqlite' | 'memory';
storagePath: string;
sessionTimeout: number;
corsOrigins: string[];
}
/**
* Loads configuration from environment variables
*/
export function loadConfig(): Config {
return {
port: parseInt(process.env.PORT || '3000', 10),
storageType: (process.env.STORAGE_TYPE || 'sqlite') as 'sqlite' | 'memory',
storagePath: process.env.STORAGE_PATH || ':memory:',
sessionTimeout: parseInt(process.env.SESSION_TIMEOUT || '300000', 10),
corsOrigins: process.env.CORS_ORIGINS
? process.env.CORS_ORIGINS.split(',').map(o => o.trim())
: ['*'],
};
}