Skip to content

Commit

Permalink
feat: and vault secret handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahanmmi committed Apr 10, 2024
1 parent 09587e7 commit 2fb2249
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/vault/azure_vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,22 @@ type AzureVaultSecretHandler struct {
client *azsecrets.Client
}

func NewAzureVaultSecretHandler(logger *zap.Logger, config AzureVaultConfig) *AzureVaultSecretHandler {
func NewAzureVaultSecretHandler(logger *zap.Logger, config AzureVaultConfig) (*AzureVaultSecretHandler, error) {
cred, err := azidentity.NewClientSecretCredential(config.TenantId, config.ClientId, config.ClientSecret, nil)
if err != nil {
logger.Error("failed to create Azure Key Vault credential", zap.Error(err))
return nil
return nil, err
}
client, err := azsecrets.NewClient(config.BaseUrl, cred, nil)
if err != nil {
logger.Error("failed to create Azure Key Vault client", zap.Error(err))
return nil
return nil, err
}

return &AzureVaultSecretHandler{
logger: logger,
client: client,
}
}, err
}

func (a *AzureVaultSecretHandler) GetSecret(ctx context.Context, secretId string) (string, error) {
Expand Down

0 comments on commit 2fb2249

Please sign in to comment.