Skip to content

Commit b1d6cde

Browse files
authored
fix: in case if plugin is not implementing the configure ignore the failure (#112)
1 parent edc7d08 commit b1d6cde

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

pkg/catalog/catalog.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
"io"
77
"log/slog"
8+
"strings"
89

910
"github.com/openkcm/plugin-sdk/api"
1011
)
@@ -136,7 +137,8 @@ func New(ctx context.Context, config Config, repo api.Repository, builtIns ...Bu
136137
return nil, fmt.Errorf("failed to bind plugin %q: %w", pluginConfig.Name, err)
137138
}
138139

139-
if pluginConfig.DataSource == nil {
140+
externalYamlConfiguration := strings.TrimSpace(pluginConfig.YamlConfiguration)
141+
if pluginConfig.DataSource == nil && len(externalYamlConfiguration) > 0 {
140142
pluginConfig.DataSource = FixedData(pluginConfig.YamlConfiguration)
141143
}
142144

pkg/catalog/configure.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"crypto/sha512"
66
"encoding/hex"
7-
"errors"
87
"fmt"
98
"io"
109
"log/slog"
@@ -82,8 +81,8 @@ func configurePlugin(ctx context.Context, pluginLog *slog.Logger, configurer Con
8281
// The plugin doesn't support configuration and no data source was configured. Nothing to do.
8382
return nil, nil
8483
case configurer == nil && dataSource != nil:
85-
// The plugin does not support configuration but a data source was configured. This is a failure.
86-
return nil, errors.New("no supported configuration interface found")
84+
// The plugin does not support configuration but a data source was configured. Nothing to do.
85+
return nil, nil
8786
case configurer != nil && dataSource == nil:
8887
// The plugin supports configuration but no data source was configured. Default to an empty, fixed configuration.
8988
dataSource = FixedData("")

0 commit comments

Comments
 (0)