Skip to content

Commit

Permalink
Fix dropin merging
Browse files Browse the repository at this point in the history
  • Loading branch information
ppacher committed Jan 5, 2021
1 parent 6037356 commit 5b8c08d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion conf/dropin.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func ApplyDropIns(t *File, dropins []*DropIn, secReg SectionRegistry) error {
}

sectionSpec, ok := secReg.OptionsForSection(sn)
if s == nil || !ok {
if sectionSpec == nil || !ok {
return fmt.Errorf("%s: %w", sn, ErrDropInSectionNotAllowed)
}

Expand All @@ -72,6 +72,9 @@ func ApplyDropIns(t *File, dropins []*DropIn, secReg SectionRegistry) error {
}

func mergeSections(s *Section, dropInSec Section, optReg OptionRegistry) error {
if optReg == nil {
return ErrNoOptions
}
// build a lookup map for the option values in this
// drop-in section
olm := make(map[string][]Option)
Expand Down
1 change: 1 addition & 0 deletions conf/validation_errors.go → conf/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ var (
ErrUnknownSection = errors.New("unknown section")
ErrDropInSectionNotExists = errors.New("section defined in drop-in does not exist")
ErrDropInSectionNotAllowed = errors.New("drop-ins not allowed for not-unique sections")
ErrNoOptions = errors.New("no options defined")
)

0 comments on commit 5b8c08d

Please sign in to comment.