Reverting to resolve merge conflicts
This commit is contained in:
@@ -12,13 +12,12 @@ import (
|
|||||||
|
|
||||||
// Config represents the plugin manager configuration.
|
// Config represents the plugin manager configuration.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Root string `yaml:"root"`
|
Root string `yaml:"root"`
|
||||||
Signer PluginConfig `yaml:"signer"`
|
Signer PluginConfig `yaml:"signer"`
|
||||||
Verifier PluginConfig `yaml:"verifier"`
|
Verifier PluginConfig `yaml:"verifier"`
|
||||||
Decrypter PluginConfig `yaml:"decrypter"`
|
Decrypter PluginConfig `yaml:"decrypter"`
|
||||||
Encrypter PluginConfig `yaml:"encrypter"`
|
Encrypter PluginConfig `yaml:"encrypter"`
|
||||||
Publisher PluginConfig `yaml:"publisher"`
|
Publisher PluginConfig `yaml:"publisher"`
|
||||||
SchemaValidator PluginConfig `yaml:"schemaValidator"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PluginConfig represents configuration details for a plugin.
|
// PluginConfig represents configuration details for a plugin.
|
||||||
@@ -34,7 +33,6 @@ type Manager struct {
|
|||||||
dp definition.DecrypterProvider
|
dp definition.DecrypterProvider
|
||||||
ep definition.EncrypterProvider
|
ep definition.EncrypterProvider
|
||||||
pb definition.PublisherProvider
|
pb definition.PublisherProvider
|
||||||
svp definition.SchemaValidatorProvider
|
|
||||||
cfg *Config
|
cfg *Config
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,13 +72,7 @@ func NewManager(ctx context.Context, cfg *Config) (*Manager, error) {
|
|||||||
return nil, fmt.Errorf("failed to load encryption plugin: %w", err)
|
return nil, fmt.Errorf("failed to load encryption plugin: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load schema validation plugin.
|
return &Manager{sp: sp, vp: vp, pb: pb, ep: ep, dp: dp, cfg: cfg}, nil
|
||||||
svp, err := provider[definition.SchemaValidatorProvider](cfg.Root, cfg.Encrypter.ID)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("failed to load schema validation plugin: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return &Manager{sp: sp, vp: vp, pb: pb, ep: ep, dp: dp, svp: svp, cfg: cfg}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// provider loads a plugin dynamically and retrieves its provider instance.
|
// provider loads a plugin dynamically and retrieves its provider instance.
|
||||||
@@ -177,16 +169,3 @@ func (m *Manager) Publisher(ctx context.Context) (definition.Publisher, error) {
|
|||||||
}
|
}
|
||||||
return publisher, nil
|
return publisher, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encrypter retrieves the encryption plugin instance.
|
|
||||||
func (m *Manager) SchemaValidation(ctx context.Context) (definition.SchemaValidator, func() error, error) {
|
|
||||||
if m.svp == nil {
|
|
||||||
return nil, nil, fmt.Errorf("schema validation plugin provider not loaded")
|
|
||||||
}
|
|
||||||
|
|
||||||
schemaValidator, close, err := m.svp.New(ctx, m.cfg.SchemaValidator.Config)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, fmt.Errorf("failed to initialize schema validator: %w", err)
|
|
||||||
}
|
|
||||||
return schemaValidator, close, nil
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
root: pkg/plugin/implementation/
|
|
||||||
schema_validator:
|
|
||||||
id: schemaValidator
|
|
||||||
config:
|
|
||||||
schema_dir: schemas #Directory where the schema files are stored
|
|
||||||
plugin_path: pkg/plugin/implementations/
|
|
||||||
BIN
schemas.zip
Normal file
BIN
schemas.zip
Normal file
Binary file not shown.
Reference in New Issue
Block a user