package providers import ( "embed" "fmt" "io/fs" "path/filepath" "gopkg.in/yaml.v3" ) //go:embed definitions/*.yaml var definitionsFS embed.FS // loadProviders reads all YAML files from the embedded definitions FS. func loadProviders() ([]Provider, error) { var providers []Provider err := fs.WalkDir(definitionsFS, "definitions", func(path string, d fs.DirEntry, err error) error { if err != nil { return err } if d.IsDir() || filepath.Ext(path) != ".yaml" { return nil } data, err := definitionsFS.ReadFile(path) if err != nil { return fmt.Errorf("reading provider file %s: %w", path, err) } var p Provider if err := yaml.Unmarshal(data, &p); err != nil { return fmt.Errorf("parsing provider %s: %w", path, err) } providers = append(providers, p) return nil }) return providers, err }