Skip to content

Commit 1e2f74d

Browse files
Allow user to set SecretClientOptions (#194)
* allow to set SecretClientOptions * fix lint
1 parent 7eb4fe0 commit 1e2f74d

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/keyvault/AzureKeyVaultKeyValueAdapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class AzureKeyVaultKeyValueAdapter implements IKeyValueAdapter {
8080
}
8181

8282
if (this.#keyVaultOptions?.credential) {
83-
client = new SecretClient(vaultUrl.toString(), this.#keyVaultOptions.credential);
83+
client = new SecretClient(vaultUrl.toString(), this.#keyVaultOptions.credential, this.#keyVaultOptions.clientOptions);
8484
this.#secretClients.set(vaultUrl.host, client);
8585
return client;
8686
}

src/keyvault/KeyVaultOptions.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the MIT license.
33

44
import { TokenCredential } from "@azure/identity";
5-
import { SecretClient } from "@azure/keyvault-secrets";
5+
import { SecretClient, SecretClientOptions } from "@azure/keyvault-secrets";
66

77
/**
88
* Options used to resolve Key Vault references.
@@ -18,10 +18,18 @@ export interface KeyVaultOptions {
1818
*/
1919
credential?: TokenCredential;
2020

21+
/**
22+
* Configures the client options used when connecting to key vaults that have no registered SecretClient.
23+
*
24+
* @remarks
25+
* The client options will not affect the registered SecretClient instances.
26+
*/
27+
clientOptions?: SecretClientOptions;
28+
2129
/**
2230
* Specifies the callback used to resolve key vault references that have no applied SecretClient.
2331
* @param keyVaultReference The Key Vault reference to resolve.
2432
* @returns The secret value.
2533
*/
2634
secretResolver?: (keyVaultReference: URL) => string | Promise<string>;
27-
}
35+
}

0 commit comments

Comments
 (0)