@@ -83,6 +83,9 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
8383 #ffRefreshInterval: number = DEFAULT_REFRESH_INTERVAL_IN_MS ;
8484 #ffRefreshTimer: RefreshTimer ;
8585
86+ // Key Vault references
87+ #resolveSecretInParallel: boolean = false ;
88+
8689 /**
8790 * Selectors of key-values obtained from @see AzureAppConfigurationOptions.selectors
8891 */
@@ -163,6 +166,10 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
163166 }
164167 }
165168
169+ if ( options ?. keyVaultOptions ?. parallelSecretResolutionEnabled ) {
170+ this . #resolveSecretInParallel = options . keyVaultOptions . parallelSecretResolutionEnabled ;
171+ }
172+
166173 this . #adapters. push ( new AzureKeyVaultKeyValueAdapter ( options ?. keyVaultOptions ) ) ;
167174 this . #adapters. push ( new JsonKeyValueAdapter ( ) ) ;
168175 }
@@ -496,7 +503,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
496503
497504 const secretResolutionPromises : Promise < void > [ ] = [ ] ;
498505 for ( const setting of loadedSettings ) {
499- if ( isSecretReference ( setting ) ) {
506+ if ( this . #resolveSecretInParallel && isSecretReference ( setting ) ) {
500507 // secret references are resolved asynchronously to improve performance
501508 const secretResolutionPromise = this . #processKeyValue( setting )
502509 . then ( ( [ key , value ] ) => {
@@ -508,9 +515,11 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
508515 // adapt configuration settings to key-values
509516 const [ key , value ] = await this . #processKeyValue( setting ) ;
510517 keyValues . push ( [ key , value ] ) ;
518+ }
519+ if ( secretResolutionPromises . length > 0 ) {
520+ // wait for all secret resolution promises to be resolved
521+ await Promise . all ( secretResolutionPromises ) ;
511522 }
512- // wait for all secret resolution promises to be resolved
513- await Promise . all ( secretResolutionPromises ) ;
514523
515524 this . #clearLoadedKeyValues( ) ; // clear existing key-values in case of configuration setting deletion
516525 for ( const [ k , v ] of keyValues ) {
0 commit comments