diff --git a/internal/infrastructure/configuration/apply.go b/internal/infrastructure/configuration/apply.go index 1261e3193..94aef0dc1 100644 --- a/internal/infrastructure/configuration/apply.go +++ b/internal/infrastructure/configuration/apply.go @@ -7,19 +7,8 @@ import ( "strings" "gopkg.in/yaml.v3" - - "github.com/samcharles93/archie-core/internal/config" ) -// ApplyOverlayValues decodes a nested map of overrides into cfg, replacing -// only the keys present. overrides is not mutated. -func ApplyOverlayValues(cfg *config.Config, overrides map[string]any) error { - if len(overrides) == 0 { - return nil - } - return applyOverlayMapping(cfg, overrides) -} - // applyOverlayFile layers the overlay file at path over target and returns // the file's unconsumed keys. func applyOverlayFile(path string, target any) ([]string, error) { diff --git a/internal/infrastructure/configuration/loader.go b/internal/infrastructure/configuration/loader.go index 6ddc9027c..29087b72a 100644 --- a/internal/infrastructure/configuration/loader.go +++ b/internal/infrastructure/configuration/loader.go @@ -141,25 +141,6 @@ func (l *Loader) Overlay(basePath, overlayPath string) (*Document, error) { return l.overlayFile(basePath, overlayPath) } -// ApplyOverlay layers runtime overrides over a copy of doc, then defaults and -// validates. doc is not mutated. -func (l *Loader) ApplyOverlay(doc *Document, overrides map[string]any) (*Document, error) { - next := *doc - next.Config = doc.Config.Clone() - next.Provenance.Origins = append([]Origin(nil), doc.Provenance.Origins...) - if len(overrides) == 0 { - return l.finalize(&next, Validate) - } - if err := ApplyOverlayValues(&next.Config, overrides); err != nil { - return nil, err - } - if err := applySchedulingOverlay(&next.Scheduling, overrides); err != nil { - return nil, err - } - next.Provenance.record(Origin{Path: "config_overlay (runtime)", Role: RoleMain, Layer: LayerOverlay}) - return l.finalize(&next, Validate) -} - func (l *Loader) overlayFile(basePath, overlayPath string) (*Document, error) { doc := &Document{} diff --git a/internal/infrastructure/configuration/scheduling.go b/internal/infrastructure/configuration/scheduling.go index 0ae9b8de5..492ba3471 100644 --- a/internal/infrastructure/configuration/scheduling.go +++ b/internal/infrastructure/configuration/scheduling.go @@ -1,10 +1,7 @@ package configuration import ( - "fmt" "time" - - "gopkg.in/yaml.v3" ) // SchedulingInput is the external [scheduling] input document. It deliberately @@ -56,19 +53,3 @@ func decodeSchedulingFileKeys(path string, target *SchedulingInput) ([]string, e *target = doc.Scheduling return keys, nil } - -func applySchedulingOverlay(target *SchedulingInput, overrides map[string]any) error { - if len(overrides) == 0 { - return nil - } - data, err := yaml.Marshal(overrides) - if err != nil { - return fmt.Errorf("%w: encoding scheduling overlay: %w", ErrUnreadable, err) - } - doc := schedulingDocument{Scheduling: *target} - if err := yaml.Unmarshal(data, &doc); err != nil { - return fmt.Errorf("%w: parsing scheduling overlay: %w", ErrUnreadable, err) - } - *target = doc.Scheduling - return nil -}