Verify catalog and Audita compatibility offline
This commit is contained in:
@@ -2,6 +2,7 @@ package glossary
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
|
||||
configkit "go.maximumdirect.net/configkit"
|
||||
@@ -81,7 +82,14 @@ func resolveCollection(name, path string, inline map[string]any) (any, error) {
|
||||
underlays = append(underlays, configkit.Underlay{Inputs: []configkit.Input{{Source: empty}}})
|
||||
}
|
||||
if path != "" {
|
||||
file := configkit.Input{Source: configkit.File(path), Imports: true}
|
||||
absolute, err := filepath.Abs(path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("resolve %s vocabulary path %q: %w", name, path, err)
|
||||
}
|
||||
// Vocabulary files may import sibling fragments relative to their own
|
||||
// locations; let ConfigKit resolve those imports in the host filesystem.
|
||||
root := filepath.VolumeName(absolute) + string(filepath.Separator)
|
||||
file := configkit.Input{Source: configkit.File(absolute), Imports: true, Filesystem: &configkit.FilesystemContext{Root: root}}
|
||||
loaded, err := configkit.LoadLayered(file, configkit.LayeredOptions[map[string]any]{Definition: definition})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("load %s vocabulary %q: %w", name, path, err)
|
||||
|
||||
Reference in New Issue
Block a user