Support independent native configuration comparisons and overrides
This commit is contained in:
@@ -18,8 +18,9 @@ func LoadPipeline(path string) (*PipelineConfig, error) {
|
||||
// PipelineLoadOptions carries an optional explicit overlay selection. Nil,
|
||||
// empty, and the exact name "default" select the base configuration.
|
||||
type PipelineLoadOptions struct {
|
||||
Overlay *string
|
||||
Search *configkit.Search
|
||||
Overlay *string
|
||||
Search *configkit.Search
|
||||
Overrides []configkit.Override
|
||||
}
|
||||
|
||||
// LoadPipelineWithOptions loads pipeline configuration with strict field
|
||||
@@ -32,24 +33,6 @@ func LoadPipelineWithOptions(path string, opts PipelineLoadOptions) (*PipelineCo
|
||||
return finalizeLoadedPipeline(cfg)
|
||||
}
|
||||
|
||||
// LoadPipelineOverlayPair resolves two overlays as independent ConfigKit loads.
|
||||
func LoadPipelineOverlayPair(path, leftOverlay, rightOverlay string) (*PipelineConfig, *PipelineConfig, error) {
|
||||
if leftOverlay == rightOverlay {
|
||||
return nil, nil, fmt.Errorf("load pipeline overlays: left and right overlay selections must differ")
|
||||
}
|
||||
leftOptions := PipelineLoadOptions{Overlay: &leftOverlay}
|
||||
rightOptions := PipelineLoadOptions{Overlay: &rightOverlay}
|
||||
left, err := LoadPipelineWithOptions(path, leftOptions)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("load left pipeline overlay: %w", err)
|
||||
}
|
||||
right, err := LoadPipelineWithOptions(path, rightOptions)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("load right pipeline overlay: %w", err)
|
||||
}
|
||||
return left, right, nil
|
||||
}
|
||||
|
||||
func finalizeLoadedPipeline(cfg *PipelineConfig) (*PipelineConfig, error) {
|
||||
if err := finalizePipelineResolution(cfg); err != nil {
|
||||
return nil, fmt.Errorf("load pipeline config: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user