Reverting to resolve merge conflicts

This commit is contained in:
tanyamadaan
2025-03-25 16:21:04 +05:30
parent 671d0b614b
commit 9f921949d1
3 changed files with 7 additions and 34 deletions

View File

@@ -12,13 +12,12 @@ import (
// Config represents the plugin manager configuration.
type Config struct {
Root string `yaml:"root"`
Signer PluginConfig `yaml:"signer"`
Verifier PluginConfig `yaml:"verifier"`
Decrypter PluginConfig `yaml:"decrypter"`
Encrypter PluginConfig `yaml:"encrypter"`
Publisher PluginConfig `yaml:"publisher"`
SchemaValidator PluginConfig `yaml:"schemaValidator"`
Root string `yaml:"root"`
Signer PluginConfig `yaml:"signer"`
Verifier PluginConfig `yaml:"verifier"`
Decrypter PluginConfig `yaml:"decrypter"`
Encrypter PluginConfig `yaml:"encrypter"`
Publisher PluginConfig `yaml:"publisher"`
}
// PluginConfig represents configuration details for a plugin.
@@ -34,7 +33,6 @@ type Manager struct {
dp definition.DecrypterProvider
ep definition.EncrypterProvider
pb definition.PublisherProvider
svp definition.SchemaValidatorProvider
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)
}
// Load schema validation plugin.
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
return &Manager{sp: sp, vp: vp, pb: pb, ep: ep, dp: dp, cfg: cfg}, nil
}
// 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
}
// 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
}

View File

@@ -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

Binary file not shown.