Refactor configuration system with centralized type-safe config package

- Create internal/config package with unified config structs and validation
- Abstract viper dependency behind config.Loader interface for better testability
- Replace manual config parsing and type assertions with type-safe loading
- Consolidate AuthConfig, SiteConfig, and DiscoveryConfig into single package
- Add comprehensive validation with clear error messages
- Remove ~200 lines of duplicate config handling code
- Maintain backward compatibility with existing config files
This commit is contained in:
2025-10-08 17:58:03 +02:00
parent 2959ecedf9
commit 38c2897ece
11 changed files with 550 additions and 332 deletions

View File

@@ -7,6 +7,7 @@ import (
"path/filepath"
"strings"
"github.com/insertr/insertr/internal/config"
"github.com/insertr/insertr/internal/engine"
)
@@ -17,13 +18,8 @@ type EnhancementConfig struct {
GenerateIDs bool
}
// DiscoveryConfig configures element discovery
type DiscoveryConfig struct {
Enabled bool
Aggressive bool
Containers bool
Individual bool
}
// Type alias for backward compatibility
type DiscoveryConfig = config.DiscoveryConfig
// Enhancer combines discovery, ID generation, and content injection in unified pipeline
type Enhancer struct {