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
1. Set an environment variable named **AZURE_APPCONFIG_CONNECTION_STRING**, and set it to the connection string of your App Configuration store. At the command line, run the following command:
112
103
113
-
async function run() {
114
-
// Connect to Azure App Configuration using connection string
115
-
const settings = await load(connectionString, {
116
-
featureFlagOptions: {
117
-
enabled: true,
118
-
// Note: selectors must be explicitly provided for feature flags.
// Create a feature flag provider which uses a map as feature flag source
130
-
const ffProvider = new ConfigurationMapFeatureFlagProvider(settings);
131
-
// Create a feature manager which will evaluate the feature flag
132
-
const fm = new FeatureManager(ffProvider);
106
+
To run the app locally using the Windows command prompt, run the following command and replace `<app-configuration-store-connection-string>` with the connection string of your app configuration store:
133
107
134
-
while (true) {
135
-
await settings.refresh(); // Refresh to get the latest feature flag settings
136
-
const isEnabled = await fm.isEnabled("Beta"); // Evaluate the feature flag
If you use Windows PowerShell, run the following command and replace `<app-configuration-store-connection-string>` with the connection string of your app configuration store:
If you use macOS, run the following command and replace `<app-configuration-store-connection-string>` with the connection string of your app configuration store:
If you use Linux, run the following command and replace `<app-configuration-store-connection-string>` with the connection string of your app configuration store:
@@ -68,46 +68,10 @@ Create a file named *app.js* in the *app-configuration-quickstart* directory and
68
68
69
69
### Sample 1: Load key-values with default selector
70
70
71
-
In this sample, you connect to Azure App Configuration and load key-values without specifying advanced options. By default, it loads all key-values with no label. You can either use Azure credential or connection string to connect to Azure App Configuration.
71
+
In this sample, you connect to Azure App Configuration using a connection string and load key-values without specifying advanced options.
72
+
By default, it loads all key-values with no label.
### Sample 3: Load key-values and trim prefix from keys
224
145
225
146
In this sample, you load key-values with an option `trimKeyPrefixes`.
226
147
After key-values are loaded, the prefix "app." is trimmed from all keys.
227
148
This is useful when you want to load configurations that are specific to your application by filtering to a certain key prefix, but you don't want your code to carry the prefix every time it accesses the configuration.
1. Set an environment variable named **AZURE_APPCONFIG_ENDPOINT** or **AZURE_APPCONFIG_CONNECTION_STRING**, depending on the method you used to connect to App Config. Set its value to the endpoint or connection string of your App Configuration store. The following example shows how to set an environment variable to store the connection string on different platforms.
184
+
1. Set an environment variable named **AZURE_APPCONFIG_CONNECTION_STRING**, and set it to the connection string of your App Configuration store. At the command line, run the following command:
To run the app locally using the Windows command prompt, run the following command and replace `<app-configuration-store-endpoint>` with the endpoint of your app configuration store:
188
+
To run the app locally using the Windows command prompt, run the following command and replace `<app-configuration-store-connection-string>` with the connection string of your app configuration store:
If you use Windows PowerShell, run the following command and replace `<app-configuration-store-endpoint>` with the endpoint of your app configuration store:
196
+
If you use Windows PowerShell, run the following command and replace `<app-configuration-store-connection-string>` with the connection string of your app configuration store:
If you use macOS, run the following command and replace `<app-configuration-store-endpoint>` with the endpoint of your app configuration store:
204
+
If you use macOS, run the following command and replace `<app-configuration-store-connection-string>` with the connection string of your app configuration store:
If you use Linux, run the following command and replace `<app-configuration-store-endpoint>` with the endpoint of your app configuration store:
212
+
If you use Linux, run the following command and replace `<app-configuration-store-connection-string>` with the connection string of your app configuration store:
Using the Windows command prompt, restart the command prompt to allow the change to take effect and run the following command:
343
225
344
226
```cmd
345
-
echo %AZURE_APPCONFIG_ENDPOINT%
227
+
echo %AZURE_APPCONFIG_CONNECTION_STRING%
346
228
```
347
229
348
230
### [PowerShell](#tab/powershell)
349
231
350
232
If you use Windows PowerShell, run the following command:
351
233
352
234
```azurepowershell
353
-
$Env:AZURE_APPCONFIG_ENDPOINT
235
+
$Env:AZURE_APPCONFIG_CONNECTION_STRING
354
236
```
355
237
356
238
### [macOS](#tab/unix)
357
239
358
240
If you use macOS, run the following command:
359
241
360
242
```console
361
-
echo "$AZURE_APPCONFIG_ENDPOINT"
243
+
echo "$AZURE_APPCONFIG_CONNECTION_STRING"
362
244
```
363
245
364
246
### [Linux](#tab/linux)
365
247
366
248
If you use Linux, run the following command:
367
249
368
250
```console
369
-
echo "$AZURE_APPCONFIG_ENDPOINT"
251
+
echo "$AZURE_APPCONFIG_CONNECTION_STRING"
370
252
```
371
253
372
254
---
@@ -428,4 +310,4 @@ run().catch(console.error);
428
310
In this quickstart, you created a new App Configuration store and learned how to access key-values using the App Configuration JavaScript provider in a Node.js app. To learn how to configure your app to dynamically refresh configuration settings, continue to the next tutorial.
0 commit comments