Skip to content

Commit 564f16a

Browse files
update
1 parent bebf549 commit 564f16a

File tree

7 files changed

+12
-18
lines changed

7 files changed

+12
-18
lines changed
File renamed without changes.
File renamed without changes.

src/appConfigurationImpl.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ import { ConfigurationClientManager } from "./configurationClientManager.js";
6868
import { getFixedBackoffDuration, getExponentialBackoffDuration } from "./common/backoffUtils.js";
6969
import { InvalidOperationError, ArgumentError, isFailoverableError, isInputError } from "./common/errors.js";
7070
import { ErrorMessages } from "./common/errorMessages.js";
71-
import { SERVER_TIMESTAMP_HEADER } from "./cdn/constants.js";
71+
import { SERVER_TIMESTAMP_HEADER } from "./afd/constants.js";
7272

7373
const MIN_DELAY_FOR_UNHANDLED_FAILURE = 5_000; // 5 seconds
7474

@@ -554,10 +554,6 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
554554
const keyValues: [key: string, value: unknown][] = [];
555555
const loadedSettings: ConfigurationSetting[] = await this.#loadConfigurationSettings();
556556

557-
if (loadedSettings.length === 0) {
558-
return;
559-
}
560-
561557
if (this.#requestTracingEnabled && this.#aiConfigurationTracing !== undefined) {
562558
// reset old AI configuration tracing in order to track the information present in the current response from server
563559
this.#aiConfigurationTracing.reset();
@@ -614,10 +610,6 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
614610
const loadFeatureFlag = true;
615611
const featureFlagSettings: ConfigurationSetting[] = await this.#loadConfigurationSettings(loadFeatureFlag);
616612

617-
if (featureFlagSettings.length === 0) {
618-
return;
619-
}
620-
621613
if (this.#requestTracingEnabled && this.#featureFlagTracing !== undefined) {
622614
// Reset old feature flag tracing in order to track the information present in the current response from server.
623615
this.#featureFlagTracing.reset();
@@ -650,7 +642,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
650642
needRefresh = await this.#checkConfigurationSettingsChange(this.#kvSelectors);
651643
} else {
652644
for (const watchedSetting of this.#sentinels.keys()) {
653-
const configurationSettingId: ConfigurationSettingId = { key: watchedSetting.key, label: watchedSetting.label };
645+
const configurationSettingId: ConfigurationSettingId = { key: watchedSetting.key, label: watchedSetting.label, etag: this.#sentinels.get(watchedSetting)?.etag };
654646
const response: GetConfigurationSettingResponse | undefined =
655647
await this.#getConfigurationSetting(configurationSettingId, { onlyIfChanged: true });
656648

@@ -742,7 +734,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
742734
};
743735

744736
if (!this.#isAfdUsed) {
745-
// if CDN is not used, add page etags to the listOptions to send conditional request
737+
// if AFD is not used, add page etags to the listOptions to send conditional request
746738
listOptions.pageEtags = pageWatchers.map(w => w.etag ?? "") ;
747739
}
748740

src/common/errorMessages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const enum ErrorMessages {
2222
CONNECTION_STRING_OR_ENDPOINT_MISSED = "A connection string or an endpoint with credential must be specified to create a client.",
2323
REPLICA_DISCOVERY_NOT_SUPPORTED = "Replica discovery is not supported when loading from Azure Front Door.",
2424
LOAD_BALANCING_NOT_SUPPORTED = "Load balancing is not supported when loading from Azure Front Door.",
25-
WATCHED_SETTINGS_NOT_SUPPORTED = "Watched settings are not supported when loading from Azure Front Door."
25+
WATCHED_SETTINGS_NOT_SUPPORTED = "Specifying watched settings is not supported when loading from Azure Front Door. If refresh is enabled, all loaded configuration settings will be watched automatically."
2626
}
2727

2828
export const enum KeyVaultReferenceErrorMessages {

src/load.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { AzureAppConfiguration } from "./appConfiguration.js";
66
import { AzureAppConfigurationImpl } from "./appConfigurationImpl.js";
77
import { AzureAppConfigurationOptions } from "./appConfigurationOptions.js";
88
import { ConfigurationClientManager } from "./configurationClientManager.js";
9-
import { AnonymousRequestPipelinePolicy, RemoveSyncTokenPipelinePolicy } from "./cdn/cdnRequestPipelinePolicy.js";
9+
import { AnonymousRequestPipelinePolicy, RemoveSyncTokenPipelinePolicy } from "./afd/afdRequestPipelinePolicy.js";
1010
import { instanceOfTokenCredential } from "./common/utils.js";
1111
import { ArgumentError } from "./common/errors.js";
1212
import { ErrorMessages } from "./common/errorMessages.js";
@@ -27,7 +27,7 @@ export async function load(connectionString: string, options?: AzureAppConfigura
2727

2828
/**
2929
* Loads the data from Azure App Configuration service and returns an instance of AzureAppConfiguration.
30-
* @param endpoint The URL to the App Configuration store.
30+
* @param endpoint The App Configuration store endpoint.
3131
* @param credential The credential to use to connect to the App Configuration store.
3232
* @param options Optional parameters.
3333
*/
@@ -67,8 +67,8 @@ export async function load(
6767
}
6868

6969
/**
70-
* Loads the data from Azure Front Door (CDN) and returns an instance of AzureAppConfiguration.
71-
* @param endpoint The URL to the Azure Front Door.
70+
* Loads the data from Azure Front Door and returns an instance of AzureAppConfiguration.
71+
* @param endpoint The Azure Front Door endpoint.
7272
* @param appConfigOptions Optional parameters.
7373
*/
7474
export async function loadFromAzureFrontDoor(endpoint: URL | string, options?: AzureAppConfigurationOptions): Promise<AzureAppConfiguration>;

test/afd.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { AppConfigurationClient } from "@azure/app-configuration";
1111
import { load, loadFromAzureFrontDoor } from "../src/index.js";
1212
import { ErrorMessages } from "../src/common/errorMessages.js";
1313
import { createMockedKeyValue, createMockedFeatureFlag, HttpRequestHeadersPolicy, getCachedIterator, sinon, restoreMocks, createMockedConnectionString, createMockedAzureFrontDoorEndpoint, sleepInMs } from "./utils/testHelper.js";
14-
import { SERVER_TIMESTAMP_HEADER } from "../src/cdn/constants.js";
14+
import { SERVER_TIMESTAMP_HEADER } from "../src/afd/constants.js";
1515
import { isBrowser } from "../src/requestTracing/utils.js";
1616

1717
function createTimestampHeaders(timestamp: string | Date) {

test/featureFlag.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,9 @@ describe("feature flags", function () {
468468
}
469469
});
470470

471-
expect(settingsWithNonExistentTag.get("feature_management")).to.be.undefined;
471+
featureFlags = settingsWithNonExistentTag.get<any>("feature_management").feature_flags;
472+
expect(featureFlags).not.undefined;
473+
expect((featureFlags as []).length).equals(0);
472474
});
473475

474476
it("should load feature flags from snapshot", async () => {

0 commit comments

Comments
 (0)