Skip to content

Commit f081ea1

Browse files
disallow custom client option when loading from afd
1 parent 4480562 commit f081ea1

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/common/errorMessages.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ export const enum ErrorMessages {
2020
INVALID_LABEL_FILTER = "The characters '*' and ',' are not supported in label filters.",
2121
INVALID_TAG_FILTER = "Tag filter must follow the format 'tagName=tagValue'",
2222
CONNECTION_STRING_OR_ENDPOINT_MISSED = "A connection string or an endpoint with credential must be specified to create a client.",
23-
REPLICA_DISCOVERY_NOT_SUPPORTED = "Replica discovery is not supported when loading from Azure Front Door.",
24-
LOAD_BALANCING_NOT_SUPPORTED = "Load balancing is not supported when loading from Azure Front Door."
23+
AFD_REPLICA_DISCOVERY_NOT_SUPPORTED = "Replica discovery is not supported when loading from Azure Front Door.",
24+
AFD_LOAD_BALANCING_NOT_SUPPORTED = "Load balancing is not supported when loading from Azure Front Door.",
25+
AFD_CLIENT_OPTIONS_NOT_SUPPORTED = "Custom client options are not supported when loading from Azure Front Door."
2526
}
2627

2728
export const enum KeyVaultReferenceErrorMessages {

src/load.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,18 @@ export async function loadFromAzureFrontDoor(
7878
appConfigOptions: AzureAppConfigurationOptions = {}
7979
): Promise<AzureAppConfiguration> {
8080
if (appConfigOptions.replicaDiscoveryEnabled) {
81-
throw new ArgumentError(ErrorMessages.REPLICA_DISCOVERY_NOT_SUPPORTED);
81+
throw new ArgumentError(ErrorMessages.AFD_REPLICA_DISCOVERY_NOT_SUPPORTED);
8282
}
8383
if (appConfigOptions.loadBalancingEnabled) {
84-
throw new ArgumentError(ErrorMessages.LOAD_BALANCING_NOT_SUPPORTED);
84+
throw new ArgumentError(ErrorMessages.AFD_LOAD_BALANCING_NOT_SUPPORTED);
85+
}
86+
if (appConfigOptions.clientOptions) {
87+
throw new ArgumentError(ErrorMessages.AFD_CLIENT_OPTIONS_NOT_SUPPORTED);
8588
}
8689
appConfigOptions.replicaDiscoveryEnabled = false; // Disable replica discovery when loading from Azure Front Door
8790

8891
appConfigOptions.clientOptions = {
89-
...appConfigOptions.clientOptions,
9092
additionalPolicies: [
91-
...(appConfigOptions.clientOptions?.additionalPolicies || []),
9293
{ policy: new AnonymousRequestPipelinePolicy(), position: "perRetry" },
9394
{ policy: new RemoveSyncTokenPipelinePolicy(), position: "perRetry" }
9495
]

0 commit comments

Comments
 (0)