You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A *sentinel key* is a key that you update after you complete the change of all other keys. Your app monitors the sentinel key. When a change is detected, your app refreshes all configuration values. This approach helps to ensure the consistency of configuration in your app and reduces the overall number of requests made to your Azure App Configuration store, compared to monitoring all keys for changes.
35
+
34
36
> [!NOTE]
35
-
> A *sentinel key* is a key that you update after you complete the change of all other keys. Your app monitors the sentinel key. When a change is detected, your app refreshes all configuration values. This approach helps to ensure the consistency of configuration in your app and reduces the overall number of requests made to your Azure App Configuration store, compared to monitoring all keys for changes.
37
+
> If you use version **2.0.0-preview.2** or later of [@azure/app-configuration-provider](https://www.npmjs.com/package/@azure/app-configuration-provider), the App Configuration provider will by default refresh based on monitoring the key-value collection. Sentinel key is not needed for refresh. For more information, please go to [Monitor key-value collection for refresh](#monitor-key-value-collection-for-refresh)
36
38
37
39
## Console applications
38
40
@@ -49,7 +51,7 @@ You can connect to App Configuration using either Microsoft Entra ID (recommende
49
51
50
52
```javascript
51
53
// Connecting to Azure App Configuration using endpoint and token credential
52
-
constsettings=awaitload(endpoint, credential, {
54
+
constappConfig=awaitload(endpoint, credential, {
53
55
// Setting up to refresh when the sentinel key is changed
54
56
refreshOptions: {
55
57
enabled:true,
@@ -65,7 +67,7 @@ You can connect to App Configuration using either Microsoft Entra ID (recommende
65
67
66
68
```javascript
67
69
// Connecting to Azure App Configuration using endpoint and token credential
// Polling for configuration changes every 5 seconds
174
176
while (true) {
175
177
await sleepInMs(5000); // Waiting before the next refresh
176
-
await settings.refresh(); // Refreshing the configuration setting
178
+
await appConfig.refresh(); // Refreshing the configuration setting
177
179
console.log(config.message); // Consume current value of message from an object
178
180
}
179
181
}
@@ -211,6 +213,23 @@ You can connect to App Configuration using either Microsoft Entra ID (recommende
211
213
Hello World - Updated!
212
214
```
213
215
216
+
## Monitor key-value collection for refresh
217
+
218
+
Instead of monitoring any sentinel key, the App Configuration provider supports for monitoring all selected key-values. Configuration will be refreshed if any of key-values are updated. Watching the sentinel key for refresh helps ensure data integrity of configuration changes, but it is now optional. This behavior is activated when you enable the refresh but do not specify any watched keys in`AzureAppConfigurationOptions.refreshOptions`
appConfig.refresh(); // Configuration will be refreshed if any of key-values are updated.
229
+
```
230
+
231
+
This feature is available for version **2.0.0-preview.2** or later of [@azure/app-configuration-provider](https://www.npmjs.com/package/@azure/app-configuration-provider).
232
+
214
233
## Server application
215
234
216
235
The following example shows how to update an existing http server to use refreshable configuration values.
@@ -265,7 +284,7 @@ The following example shows how to update an existing http server to use refresh
265
284
appConfig = await load(endpoint, credential, {
266
285
refreshOptions: {
267
286
enabled: true,
268
-
watchedSettings: [{ key: "sentinel" }], // Watch for changes to the key "sentinel" and refreshes the configuration when it changes
287
+
// without registering any watched setting/sentinel key, the provider will monitor the key-value collection for refresh
269
288
refreshIntervalInMs: 15_000 // Set the refresh interval
270
289
}
271
290
});
@@ -315,12 +334,11 @@ We recommend to implement request-driven configuration refresh for your web appl
315
334
> [!div class="mx-imgBorder"]
316
335
> 
317
336
318
-
1. Update the following key-values to the Azure App Configuration store. Update value of the key `message` first and then `sentinel`.
337
+
1. Update the following key-values to the Azure App Configuration store. Update value of the key `message`.
0 commit comments