- Phase 7: Config Consolidation - CONTEXT.md: Defines scope, decisions, and requirements - PLAN.md: 18-task implementation plan with detailed acceptance criteria - Centralize all configs into config/ folder - Update deploy scripts, backend loading, and documentation - Maintain backward compatibility with inventory.env Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
4.6 KiB
4.6 KiB
Phase 7: Config Consolidation - Context
Gathered: 2026-04-23 Status: Ready for planning Source: User Requirements
Phase Boundary
Consolidate all application configuration files into a centralized config/ folder in the project root. This includes backend configurations, frontend configurations, deployment settings, and network configurations. Update all deployment scripts, application startup procedures, and backend/frontend code to load configurations from this centralized location.
Scope:
- Create and establish
config/folder as the single source of truth for all application configuration - Migrate existing configuration files (inventory.env and variants) to config folder with meaningful names
- Update all scripts (deploy.sh, run_standalone.sh, etc.) to reference the new config location
- Refactor backend config_loader.py and config_manager.py to read from config folder
- Update frontend environment loading if applicable
- Verify and clean up root directory scripts that are no longer needed
- Ensure Docker deployment, standalone deployment, and development all work correctly with new structure
Deliverables:
config/folder with structured configuration files- Updated backend configuration loading mechanism
- Updated deployment scripts
- Updated startup procedures (Docker and standalone)
- Documentation of configuration structure in README/DEPLOYMENT.md
Implementation Decisions
Configuration Structure
- Create
config/folder in project root as the central location for all configurations - Use meaningful filenames:
backend.env,frontend.env,network.env,docker.env(for docker-compose) - Keep backward compatibility: Support both old (
inventory.env) and new (config/backend.env) paths during transition - Environment variable precedence: System env vars > Docker build args > config/backend.env > defaults in code
Backend Loading
- Update
backend/config_loader.pyto look for configs inconfig/backend.envfirst - If not found, fall back to
inventory.env(backward compatibility) - If neither exists, use system environment variables
- Log which config source is being used for debugging
Deployment Scripts
deploy.sh: Source environment fromconfig/network.envorconfig/docker.envinstead ofinventory.envrun_standalone.sh: Source configuration fromconfig/backend.envandconfig/network.env- Docker Compose: Updated to reference
config/docker.env - Scripts should create symlinks or validate that config folder exists before running
Cleanup Actions
- Remove or archive
inventory.envtemplates after migration - Audit root directory scripts for redundancy
- Update .gitignore to ensure config/ folder structure is tracked (if needed)
Documentation Updates
- Update DEPLOYMENT.md with new config folder structure
- Update README.md with configuration setup instructions
- Add config/README.md explaining each config file's purpose
Specific Ideas
-
Config Files to Create:
config/backend.env— Backend-specific variables (database, AI keys, auth settings)config/frontend.env— Frontend-specific variables (API endpoints, feature flags)config/network.env— Network/deployment variables (ports, SSL, server IPs)config/docker.env— Docker-specific overrides (for docker-compose.yml)config/README.md— Documentation of all configuration files
-
Scripts to Update:
deploy.sh— Update to source from config/ folderrun_standalone.sh— Update network config loadingexport_prod.sh— Ensure it uses new config structureinstall_service.sh— Update systemd service to reference new config paths__push_ALL_to_remote.sh— Review for config-related updates
-
Backend Changes:
backend/config_loader.py— Update load order: config/backend.env > inventory.env > env varsbackend/config_manager.py— Update to read/write from config/backend.envbackend/entrypoint.sh— Source from config/ instead of root level
-
Testing Requirements:
- Docker deployment with new config structure
- Standalone deployment with new config structure
- Environment variable override behavior still works
- Backward compatibility: old inventory.env still loads if config/ doesn't exist
Deferred Ideas
- Dynamic config hot-reload without restart (future optimization)
- Config validation framework (future enhancement)
- Encrypted sensitive values in config files (future security enhancement)
- Web UI for configuration management (future feature)
Phase: 7-config-consolidation
Context gathered: 2026-04-23 from user requirements