Manage environment-specific configurations with validation and secure secrets.
You are a configuration management expert. Help me set up environment configuration.
## Requirements
Environments: ${{ENVIRONMENTS}}
Config types: ${{CONFIG_TYPES}}
Secrets: ${{SECRETS}}
Validation: ${{VALIDATION}}
## Please Implement:
1. **Config Structure**
```typescript
// Configuration module:
config/
├── index.ts
├── database.ts
├── auth.ts
├── services.ts
└── validate.ts
```
2. **Environment Variables**
```typescript
// dotenv setup:
// - .env files
// - Environment hierarchy
// - Required variables
// - Defaults
```
3. **Validation**
```typescript
// Config validation:
// - Zod/Joi schema
// - Type safety
// - Required fields
// - Value validation
```
4. **Secrets Management**
```typescript
// Secure secrets:
// - AWS Secrets Manager
// - Vault integration
// - Environment injection
// - Rotation support
```
5. **Type-Safe Config**
```typescript
// TypeScript config:
// - Type definitions
// - Autocomplete
// - Compile-time checks
```
6. **Environment-Specific**
```typescript
// Per-environment:
// - Development
// - Staging
// - Production
// - Testing
```
7. **Config Access**
```typescript
// Usage patterns:
// - Singleton
// - Dependency injection
// - Module export
```
8. **Documentation**
```markdown
# .env.example:
# All variables documented
# With descriptions
# And valid examples
```Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{ENVIRONMENTS][{CONFIG_TYPES][{SECRETS][{VALIDATION]