(ctx context.Context)
| 44 | } |
| 45 | |
| 46 | func (c *registerClient) register(ctx context.Context) (*runtimeConfig, error) { |
| 47 | c.config.Logger.Printf("Registering plugin %s...", c.pluginName) |
| 48 | ctx, cancel := context.WithTimeout(ctx, c.timeout) |
| 49 | defer cancel() |
| 50 | req := connect.NewRequest(pluginsv1.RegisterPluginRequest_builder{ |
| 51 | Name: proto.String(c.pluginName), |
| 52 | Version: proto.String(c.config.Version.String()), |
| 53 | SecretsProvider: pluginsv1.SecretsProvider_builder{ |
| 54 | Pattern: proto.String(c.config.Pattern.String()), |
| 55 | }.Build(), |
| 56 | }.Build()) |
| 57 | resp, err := c.engineClient.RegisterPlugin(ctx, req) |
| 58 | if err != nil { |
| 59 | return nil, fmt.Errorf("failed to register with secrets engine: %w", err) |
| 60 | } |
| 61 | return &runtimeConfig{ |
| 62 | Engine: resp.Msg.GetEngineName(), |
| 63 | Version: resp.Msg.GetEngineVersion(), |
| 64 | }, nil |
| 65 | } |
| 66 | |
| 67 | type runtimeConfig struct { |
| 68 | Engine string |
no test coverage detected