docs: update documentation to reflect unified config system

- Update config README to focus on current unified system rather than migration
- Update architecture migration doc to reference unifiedConfig instead of appConfig
- Update implementation summary to reference unified.config.ts
- Remove migration-specific content not relevant for new applications
- Provide clear guidance for working with unified configuration system
This commit is contained in:
William Valentin
2025-09-08 20:43:44 -07:00
parent 25b68ee67d
commit b81f9b2970
3 changed files with 51 additions and 34 deletions

View File

@@ -4,24 +4,23 @@ This directory contains the unified configuration system for the RxMinder applic
## Overview
The unified configuration system replaces the previous scattered approach of multiple `.env` files and environment-specific configurations with a centralized, type-safe, and environment-aware system.
The unified configuration system serves as the **single source of truth** for all application configuration. It reads from your `.env` file for environment-specific overrides and provides a centralized, type-safe, and environment-aware configuration system.
### Key Benefits
- 🎯 **Single Source of Truth**: All configuration in one place
- 🎯 **Single Source of Truth**: Unified config with `.env` file overrides
- 🔒 **Type Safety**: Full TypeScript support with interfaces
- 🌍 **Environment Aware**: Automatic environment-specific overrides
- 🌍 **Environment Aware**: Reads from `.env` file for environment-specific settings
- 🚀 **Auto-Generation**: Generates all necessary config files automatically
- 🔄 **Easy Migration**: Smooth transition from old config system
- 📝 **Self-Documenting**: Clear structure with validation
- 🔄 **Simplified Architecture**: Clean, maintainable configuration management
- 📝 **Self-Documenting**: Clear structure with validation and debugging tools
## File Structure
```
config/
├── README.md # This documentation
├── unified.config.ts # Main unified configuration
├── app.config.ts # Legacy config (deprecated)
├── unified.config.ts # Single source of truth configuration
└── generated/ # Auto-generated configs
├── development.config.ts
├── staging.config.ts
@@ -49,20 +48,21 @@ if (featureFlags.enableOAuth) {
}
```
### 2. Environment Variables
### 2. Environment Variables (.env file)
The system reads from environment variables with fallbacks to sensible defaults:
The system reads from your `.env` file as the primary source for environment-specific overrides:
```bash
# Required variables
APP_NAME=RxMinder
# .env file - Primary configuration source
APP_NAME=rxminder
NODE_ENV=production
VITE_COUCHDB_URL=http://couchdb:5984
VITE_COUCHDB_URL=http://rxminder-couchdb-service:5984
VITE_COUCHDB_USER=admin
VITE_COUCHDB_PASSWORD=your-secure-password
# Optional variables with defaults
APP_VERSION=1.0.0
DEBUG_MODE=false
ENABLE_OAUTH=true
# Container configuration
CONTAINER_REGISTRY=your-registry.com
CONTAINER_REPOSITORY=your-org/app
```
### 3. Generating Config Files
@@ -278,23 +278,29 @@ bun scripts/generate-unified-config.ts production
bun scripts/generate-unified-config.ts --dry-run
```
## Migration from Old System
## Working with the Configuration System
If you're migrating from the old configuration system:
### 1. Basic Usage
### 1. Backup Current Configuration
Access configuration in your application:
```bash
bun scripts/generate-unified-config.ts production
```typescript
import { unifiedConfig } from './config/unified.config';
const appName = unifiedConfig.app.name;
const dbUrl = unifiedConfig.database.url;
```
### 2. Run Migration
### 2. Environment Overrides
Add variables to your `.env` file:
```bash
bun scripts/generate-unified-config.ts --all
APP_NAME=my-app
VITE_COUCHDB_URL=http://localhost:5984
```
### 3. Generate New Config Files
### 3. Generate Configs
```bash
make generate-config
@@ -402,10 +408,21 @@ make deploy-prod-quick
For questions or issues with the unified configuration system:
1. Check this documentation first
2. Run diagnostic commands (`make config-debug`, `make validate-config`)
2. Run diagnostic commands:
- `make config-check` - Health check of entire config system
- `make config-debug` - Show current configuration values
3. Review generated configuration files
4. Check application logs for configuration-related errors
4. Check `.env` file for environment-specific overrides
5. Check application logs for configuration-related errors
## Configuration Priority
The unified config uses this priority order:
1. **`.env` file** (highest priority) - Environment-specific overrides
2. **Environment configs** (medium priority) - Built-in environment defaults
3. **Default values** (lowest priority) - Fallback defaults in unified.config.ts
---
_This unified configuration system provides a robust, scalable, and maintainable approach to application configuration management._
_The unified configuration system provides a robust, scalable, and maintainable approach to application configuration management with `.env` file integration._