Fixed two critical issues preventing offline-first operation: 1. **Instant startup** - Removed blocking GetDB() call during server initialization. Server now starts in <10ms instead of 1+ minute. - Changed setupRouter() to use lazy DB connection via ConnectionManager - mariaDB connection is now nil on startup, established only when needed - Fixes timeout issues when MariaDB is unreachable 2. **Offline mode nil pointer panics** - Added graceful degradation when database is offline: - ComponentService.GetCategories() returns DefaultCategories if repo is nil - ComponentService.List/GetByLotName checks for nil repo - PricelistService methods return empty/error responses in offline mode - All methods properly handle nil repositories **Before**: Server startup took 1min+ and crashed with nil pointer panic when trying to load /configurator page offline. **After**: Server starts instantly and serves pages in offline mode using DefaultCategories and SQLite data. Related to Phase 2.5: Full Offline Mode (local-first architecture) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
5.6 KiB
5.6 KiB