mirror of
https://github.com/xtr-dev/rondevu-server.git
synced 2025-12-10 02:43:24 +00:00
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>
27 lines
750 B
TypeScript
27 lines
750 B
TypeScript
/**
|
|
* 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())
|
|
: ['*'],
|
|
};
|
|
}
|