(id string, item config.PluginInstanceConfig)
| 551 | } |
| 552 | |
| 553 | func storeManifestFromPluginConfig(id string, item config.PluginInstanceConfig) (sdkpluginstore.Manifest, bool, error) { |
| 554 | if item.Raw.Kind == 0 { |
| 555 | return sdkpluginstore.Manifest{}, false, nil |
| 556 | } |
| 557 | storeNode := yamlMappingValue(&item.Raw, "store") |
| 558 | if storeNode == nil || storeNode.Kind == 0 { |
| 559 | return sdkpluginstore.Manifest{}, false, nil |
| 560 | } |
| 561 | var manifest sdkpluginstore.Manifest |
| 562 | if errDecode := storeNode.Decode(&manifest); errDecode != nil { |
| 563 | return sdkpluginstore.Manifest{}, false, fmt.Errorf("home plugins: decode store manifest for %s: %w", id, errDecode) |
| 564 | } |
| 565 | if strings.TrimSpace(manifest.ID) == "" { |
| 566 | manifest.ID = strings.TrimSpace(id) |
| 567 | } |
| 568 | if errValidate := manifest.Validate(); errValidate != nil { |
| 569 | return sdkpluginstore.Manifest{}, false, fmt.Errorf("home plugins: invalid store manifest for %s: %w", id, errValidate) |
| 570 | } |
| 571 | return manifest, true, nil |
| 572 | } |
| 573 | |
| 574 | func yamlMappingValue(node *yaml.Node, key string) *yaml.Node { |
| 575 | if node == nil || node.Kind != yaml.MappingNode { |
no test coverage detected