From aab9912e0655865507a65cd74bc001982f25fcee Mon Sep 17 00:00:00 2001 From: zhiyuanliang Date: Wed, 3 Jan 2024 14:19:30 +0800 Subject: [PATCH 1/2] update readme --- examples/README.md | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/examples/README.md b/examples/README.md index 74b5ceed..2ffa90e3 100644 --- a/examples/README.md +++ b/examples/README.md @@ -14,9 +14,16 @@ Samples retrieve credentials to access your App Configuration store from environ Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. -## Setup +## Add a key-value +Add the following key-value to the App Configuration store and leave Label and Content Type with their default values. For more information about how to add key-values to a store using the Azure portal or the CLI, go to [Create a key-value](./quickstart-azure-app-configuration-create.md#create-a-key-value). -To run the samples using the published version of the package: +| Key | Value | +|------------------------|----------------| +| *app.settings.message* | *Hello World!* | + +## Setup & Run + +To run the examples using the published version of the package: 1. Install the dependencies using `npm`: @@ -24,15 +31,20 @@ To run the samples using the published version of the package: npm install ``` -2. There are two ways to run the samples using correct credentials: +2. There are two ways to run the examples using correct credentials: + + - Edit the file `.env.template`, adding the access keys to your App Configuration store. and rename the file from `.env.template` to just `.env`. The example programs will read this file automatically. -- Edit the file `.env.template`, adding the correct credentials to access your Azure App Configuration store and rename the file from `.env.template` to just `.env`. -Then run the samples, it will read this file automatically. + - Alternatively, you can set the environment variables to the access keys to your App Configuration store. In this case, setting up the `.env` file is not required. + ```bash + npx cross-env APPCONFIG_CONNECTION_STRING="" + ``` + +3. Run the example ```bash node helloworld.mjs ``` - -- Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - ```bash - npx cross-env APPCONFIG_CONNECTION_STRING="" node helloworld.mjs + You should see the following output: + ```Output + Message from Azure App Configuration: Hello World! ``` From b194b915d6f601791d15a1bb04ede76c6248cc66 Mon Sep 17 00:00:00 2001 From: zhiyuanliang Date: Wed, 3 Jan 2024 14:21:30 +0800 Subject: [PATCH 2/2] add colon --- examples/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/README.md b/examples/README.md index 2ffa90e3..5ba5127f 100644 --- a/examples/README.md +++ b/examples/README.md @@ -40,7 +40,7 @@ To run the examples using the published version of the package: npx cross-env APPCONFIG_CONNECTION_STRING="" ``` -3. Run the example +3. Run the example: ```bash node helloworld.mjs ```