From 2fb224982d7729365da49c37ba16f4d6db16834d Mon Sep 17 00:00:00 2001 From: Mahan Zendedel DH Date: Wed, 10 Apr 2024 15:18:53 +0400 Subject: [PATCH] feat: and vault secret handler --- pkg/vault/azure_vault.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/vault/azure_vault.go b/pkg/vault/azure_vault.go index a1abb99..58ca2bd 100644 --- a/pkg/vault/azure_vault.go +++ b/pkg/vault/azure_vault.go @@ -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) {