/** * Centralized configuration constants */ export const CONFIG = { // Stats collection (server/services/stats.js) // Round-robin one-shot samples — not full-fleet stream:true (Dozzle-style streams // keep dockerd busy ~1Hz × N containers). See Settings → Performance. STATS: { INTERVAL_MS: 5000, // Min gap between allStats broadcasts ACTIVE_INTERVAL_MS: 5000, // Idle gap after each sample batch completes IDLE_INTERVAL_MS: 5000, // Reserved (peer-idle uses full pause) CACHE_TTL_MS: 2000, // Per-container broadcast cache TTL CONCURRENCY: 2, // Max parallel one-shot stats to dockerd SAMPLES_PER_TICK: 4, // Max containers sampled per tick (round-robin) LIST_INTERVAL_MS: 15000, // How often to re-list containers SMOOTHING_FACTOR: 0.2, // Client-side smoothing (if used) }, // UI updates UI: { DEBOUNCE_MS: 300, // Debounce time for UI updates SKELETON_LOADER_DELAY: 200, // Delay before showing skeleton ALERT_DURATION_MS: 5000, // Alert display duration }, // Connection CONNECTION: { TIMEOUT_MS: 30000, // Connection timeout /** Fixed delay between automatic peer reconnect attempts */ RECONNECT_DELAY_MS: 5000, /** * Default max automatic reconnect attempts when Settings has no override. * 0 = unlimited. Runtime/UI caps at 8 (see Settings → Behavior). * Client default preference is 8 tries via settings cache. */ RECONNECT_MAX_ATTEMPTS: 0, HEALTH_CHECK_INTERVAL_MS: 10000, // Health check interval }, // Container operations CONTAINER: { MAX_NAME_LENGTH: 63, MIN_NAME_LENGTH: 1, MAX_IMAGE_LENGTH: 255, /** RPC timeout for lifecycle ops (remove/stop/restart/…) — longer than dial timeout */ OPERATION_TIMEOUT_MS: 120000, }, // Terminal TERMINAL: { MIN_HEIGHT: 150, MAX_HEIGHT_RATIO: 0.9, // Max height as ratio of window SCROLLBACK_LINES: 10000, HISTORY_SIZE: 1000, }, // Storage STORAGE: { COOKIE_SIZE_LIMIT: 4000, // 4KB cookie limit (legacy) CONNECTIONS_KEY: 'peardock_connections', // localStorage mirror key USE_LOCALSTORAGE_KEY: 'peardock_use_localstorage', TEMPLATES_KEY: 'peardock_templates', // legacy LS; primary is cache/templates.json /** Desktop peer roster: ~/.config/peardock/cache/peers.json */ PEERS_CACHE_REL: '.config/peardock/cache/peers.json', /** Client prefs (theme, density, filters, table cols, …): ~/.config/peardock/cache/settings.json */ SETTINGS_CACHE_REL: '.config/peardock/cache/settings.json', /** Saved deploy templates: ~/.config/peardock/cache/templates.json */ TEMPLATES_CACHE_REL: '.config/peardock/cache/templates.json', /** Notification center history: ~/.config/peardock/cache/notifications.json */ NOTIFICATIONS_CACHE_REL: '.config/peardock/cache/notifications.json', /** Local backup history: ~/.config/peardock/cache/backups.json */ BACKUPS_CACHE_REL: '.config/peardock/cache/backups.json', /** Server alerts snapshot (synced from admin export): ~/.config/peardock/cache/alerts.json */ ALERTS_CACHE_REL: '.config/peardock/cache/alerts.json', /** localStorage key mirrored from settings cache */ SETTINGS_KEY: 'peardock.settings.v1', }, // Docker command validation DOCKER: { MAX_COMMAND_LENGTH: 500, ALLOWED_COMMANDS: [ 'ps', 'images', 'volumes', 'networks', 'info', 'version', 'logs', 'inspect', 'stats', 'top', 'diff', 'port', 'history', 'search', 'events', 'system', 'help' ], BLOCKED_COMMANDS: [ 'exec', 'run', 'create', 'start', 'stop', 'restart', 'kill', 'rm', 'rmi', 'prune', 'build', 'commit', 'push', 'pull', 'tag', 'load', 'save', 'import', 'export', 'cp', 'update' ], }, // Status codes STATUS: { CONNECTED: 'connected', DISCONNECTED: 'disconnected', CONNECTING: 'connecting', ERROR: 'error', }, // Error codes ERROR_CODES: { RATE_LIMIT_EXCEEDED: 'RATE_LIMIT_EXCEEDED', INVALID_INPUT: 'INVALID_INPUT', CONNECTION_FAILED: 'CONNECTION_FAILED', OPERATION_TIMEOUT: 'OPERATION_TIMEOUT', PERMISSION_DENIED: 'PERMISSION_DENIED', UNKNOWN_ERROR: 'UNKNOWN_ERROR', }, };