Configuration Consolidation - Unify 5 Config Systems into Single Canonical System
Resolved ๐ฌ 1 comment Opened Nov 13, 2025 by mrveiss Closed Nov 13, 2025
๐ฏ Objective
Consolidate 5 competing configuration systems into a single canonical configuration manager to eliminate duplication, improve maintainability, and establish a single source of truth for all configuration.
๐ Current State Analysis
Problem: Configuration is fragmented across multiple systems:
src/config.pysrc/unified_config.pysrc/config_helper.pysrc/config_consolidated.pysrc/unified_config_manager.py
Impact:
- Backend: 235+ direct
os.getenv()calls scattered across codebase - Frontend: 40 files with direct
import.meta.envorprocess.envaccess - Confusion about which config system to use
- No type safety or validation
- Difficult to test (need to mock env vars in 235+ places)
โ Success Criteria
- [ ] Single canonical config system chosen and documented
- [ ] All 5 config systems analyzed - features inventoried
- [ ] Best implementation selected based on code quality, type safety, validation
- [ ] All features preserved from all 5 systems (no feature loss)
- [ ] 235+ os.getenv() calls migrated to
cfg.get()pattern - [ ] 40+ frontend files migrated to centralized config service
- [ ] Type safety implemented with validation framework
- [ ] Tests updated to use single config mock
- [ ] Documentation updated with usage examples
๐ Expected Impact
Code Reduction: ~500-800 lines
Files Affected: ~280 files system-wide
Maintenance Burden: -70% (change config in 1 place, not 280)
๐ Implementation Plan
Phase 1: Backend Consolidation (Week 1)
- Inventory all features from 5 config systems
- Analyze each system - choose best base implementation
- Document selection rationale
- Port all features to chosen system
- Create migration script for os.getenv() โ cfg.get()
- Migrate backend files in batches
- Update tests
- Deprecate old config files
Phase 2: Frontend Standardization (Week 2)
- Create TypeScript config service
- Migrate 40 files from import.meta.env โ useConfig()
- Type-safe config access with validation
- Consistent NetworkConstants usage
- Update frontend tests
Phase 3: Validation & Cleanup (Week 3)
- Schema validation for all config
- Environment-specific config files
- Integration tests
- Documentation
- Remove deprecated config files
- Team training on new system
๐ Feature Preservation Checklist
From config.py:
- [ ] LLM config management
- [ ] Redis config
- [ ] Backend config
- [ ] Service URL generation
- [ ] CORS origins
From unified_config.py:
- [ ] Type safety
- [ ] Validation framework
- [ ] Environment variable substitution
- [ ] Timeout management
From config_helper.py:
- [ ] Helper utilities
- [ ] Path management
From config_consolidated.py:
- [ ] Consolidated defaults
From unified_config_manager.py:
- [ ] Manager patterns
๐ References
- CLAUDE.md - Consolidation & Refactoring Standards
- Memory MCP: "Configuration Consolidation Opportunity 2025-11"
- Related: #TBD (File Naming Audit)
๐ท๏ธ Labels
refactor, configuration, high-impact, technical-debt
โฑ๏ธ Estimate
3 weeks (15 person-days)
This issue has 1 comment on GitHub. Read the full discussion on GitHub โ