- Add comprehensive 8-phase implementation plan (docs/plan.md) - Add 28 Architecture Decision Records (docs/adr/) covering all phases - Add task tracking system with 283+ task files (docs/stories/) - Add task generator script for automated task file creation - Add reference playbooks and requirements documentation This commit establishes the complete planning foundation for the Go Platform implementation, documenting all architectural decisions and providing detailed task breakdown for Phases 0-8.
61 lines
2.1 KiB
Markdown
61 lines
2.1 KiB
Markdown
# Task 0.2.3: Implement Config Loader
|
|
|
|
## Metadata
|
|
- **Task ID**: 0.2.3
|
|
- **Title**: Implement Config Loader
|
|
- **Phase**: 0 - Project Setup & Foundation
|
|
- **Section**: 0.2 Configuration System
|
|
- **Status**: Pending
|
|
- **Priority**: High
|
|
- **Estimated Time**: 30 minutes
|
|
- **Dependencies**: 0.2.1, 0.2.2
|
|
|
|
## Description
|
|
Implement the Viper-based configuration loader in `internal/config/` that implements the `ConfigProvider` interface. This loader will handle hierarchical configuration loading from files and environment variables.
|
|
|
|
## Requirements
|
|
- Implement `ConfigProvider` interface using Viper
|
|
- Load configuration in order: defaults → environment-specific → env vars
|
|
- Support YAML configuration files
|
|
- Support environment variable overrides
|
|
- Provide placeholder for secret manager integration (Phase 6)
|
|
|
|
## Implementation Steps
|
|
1. Create `internal/config/config.go`:
|
|
- Implement `ConfigProvider` interface
|
|
- Wrap Viper instance
|
|
- Implement all interface methods
|
|
2. Create `internal/config/loader.go`:
|
|
- `LoadConfig()` function
|
|
- Load `config/default.yaml` as baseline
|
|
- Merge environment-specific YAML (development/production)
|
|
- Apply environment variable overrides
|
|
- Set up automatic environment variable binding
|
|
3. Add error handling for missing config files
|
|
4. Add logging for configuration loading
|
|
|
|
## Acceptance Criteria
|
|
- [ ] `internal/config/config.go` implements `ConfigProvider`
|
|
- [ ] `internal/config/loader.go` has `LoadConfig()` function
|
|
- [ ] Configuration loads from `config/default.yaml`
|
|
- [ ] Environment-specific configs are merged correctly
|
|
- [ ] Environment variables override file values
|
|
- [ ] Errors are handled gracefully
|
|
|
|
## Related ADRs
|
|
- [ADR-0004: Configuration Management](../../adr/0004-configuration-management.md)
|
|
|
|
## Implementation Notes
|
|
- Use Viper's `SetConfigName()` and `AddConfigPath()`
|
|
- Use `MergeInConfig()` for environment-specific files
|
|
- Use `AutomaticEnv()` for environment variable binding
|
|
- Set environment variable prefix (e.g., `GOPLT_`)
|
|
- Use `SetEnvKeyReplacer()` to replace dots with underscores
|
|
|
|
## Testing
|
|
```bash
|
|
# Test config loading
|
|
go test ./internal/config -v
|
|
```
|
|
|