Issue 511 - Initial commit part 2
This commit is contained in:
@@ -361,6 +361,27 @@ func (m *Manager) SimpleKeyManager(ctx context.Context, cache definition.Cache,
|
||||
return km, nil
|
||||
}
|
||||
|
||||
// Registry returns a RegistryLookup instance based on the provided configuration.
|
||||
// It registers a cleanup function for resource management.
|
||||
func (m *Manager) Registry(ctx context.Context, cfg *Config) (definition.RegistryLookup, error) {
|
||||
rp, err := provider[definition.RegistryLookupProvider](m.plugins, cfg.ID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to load provider for %s: %w", cfg.ID, err)
|
||||
}
|
||||
registry, closer, err := rp.New(ctx, cfg.Config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if closer != nil {
|
||||
m.closers = append(m.closers, func() {
|
||||
if err := closer(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
return registry, nil
|
||||
}
|
||||
|
||||
// Validator implements handler.PluginManager.
|
||||
func (m *Manager) Validator(ctx context.Context, cfg *Config) (definition.SchemaValidator, error) {
|
||||
panic("unimplemented")
|
||||
|
||||
Reference in New Issue
Block a user