Remove internal/content package and use engine directly
- Eliminate content.Enhancer wrapper around engine.ContentEngine - Update cmd/enhance.go to call engine.ProcessFile/ProcessDirectory directly - Update sites/manager.go to use engine.NewContentEngineWithAuth directly - Remove unused EnhancementConfig and discovery configuration logic - Simplify enhance command to use input path as site ID - Remove CLI config dependency from config package
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -17,10 +18,6 @@ func validate(config *Config) error {
|
||||
return fmt.Errorf("api config: %w", err)
|
||||
}
|
||||
|
||||
if err := validateCLI(config.CLI); err != nil {
|
||||
return fmt.Errorf("cli config: %w", err)
|
||||
}
|
||||
|
||||
if err := validateServer(config.Server); err != nil {
|
||||
return fmt.Errorf("server config: %w", err)
|
||||
}
|
||||
@@ -66,18 +63,6 @@ func validateAPI(config APIConfig) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateCLI(config CLIConfig) error {
|
||||
if config.SiteID == "" {
|
||||
return fmt.Errorf("site_id is required")
|
||||
}
|
||||
|
||||
if strings.TrimSpace(config.SiteID) != config.SiteID {
|
||||
return fmt.Errorf("site_id cannot have leading or trailing whitespace")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateServer(config ServerConfig) error {
|
||||
if config.Port < 1 || config.Port > 65535 {
|
||||
return fmt.Errorf("port must be between 1 and 65535, got %d", config.Port)
|
||||
@@ -136,13 +121,7 @@ func validateAuth(config AuthConfig) error {
|
||||
}
|
||||
|
||||
validProviders := []string{"mock", "authentik"}
|
||||
valid := false
|
||||
for _, provider := range validProviders {
|
||||
if config.Provider == provider {
|
||||
valid = true
|
||||
break
|
||||
}
|
||||
}
|
||||
valid := slices.Contains(validProviders, config.Provider)
|
||||
if !valid {
|
||||
return fmt.Errorf("invalid provider %q, must be one of: %s", config.Provider, strings.Join(validProviders, ", "))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user