diff options
Diffstat (limited to 'client/config.js')
-rw-r--r-- | client/config.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/client/config.js b/client/config.js new file mode 100644 index 0000000..d86da9e --- /dev/null +++ b/client/config.js @@ -0,0 +1,54 @@ +// JChat Client Configuration +window.JChatConfig = { + // Server configuration + API_BASE_URL: 'http://api.jchat.localhost', + WEB_BASE_URL: 'http://web.jchat.localhost', + + // Feature flags + FEATURES: { + REGISTRATION_ENABLED: true, + GUEST_ACCESS: false, + FILE_UPLOADS: true, + REAL_TIME_UPDATES: true + }, + + // UI configuration + UI: { + THEME: 'light', + AUTO_FOCUS_MESSAGE_INPUT: true, + SHOW_TYPING_INDICATORS: true, + MESSAGE_PAGE_SIZE: 50, + CONVERSATION_PAGE_SIZE: 20 + }, + + // Polling configuration + POLLING: { + INTERVAL_MS: 2000, + MAX_RETRIES: 3, + BACKOFF_MULTIPLIER: 2 + }, + + // Authentication + AUTH: { + TOKEN_STORAGE_KEY: 'jchat_auth_token', + USER_STORAGE_KEY: 'jchat_user_data', + AUTO_LOGOUT_ON_TOKEN_EXPIRE: true + }, + + // Development/Debug + DEBUG: { + LOG_LEVEL: 'info', // 'debug', 'info', 'warn', 'error' + SHOW_NETWORK_REQUESTS: false, + MOCK_SLOW_NETWORK: false + } +}; + +// Environment-specific overrides +if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') { + // Development overrides + window.JChatConfig.DEBUG.LOG_LEVEL = 'debug'; + window.JChatConfig.DEBUG.SHOW_NETWORK_REQUESTS = true; +} + +// Make config immutable +Object.freeze(window.JChatConfig); |