UNPKG

4.9 kBMarkdownView Raw
1# Azure App Configuration client library for JS
2
3Azure App Configuration is a managed service that helps developers centralize their application configurations simply and securely.
4
5Modern programs, especially programs running in a cloud, generally have many components that are distributed in nature. Spreading configuration settings across these components can lead to hard-to-troubleshoot errors during an application deployment. Use App Configuration to securely store all the settings for your application in one place.
6
7Use the client library for App Configuration to:
8
9* Create centrally stored application configuration settings
10* Retrieve settings
11* Update settings
12* Delete settings
13
14[NPM](https://www.npmjs.com/package/@azure/app-configuration) | [Product documentation](https://docs.microsoft.com/en-us/azure/azure-app-configuration/)
15
16## Getting started
17
18### Currently supported environments
19
20- Node.js version 8.x.x or higher
21
22### How to Install
23
24```bash
25npm install @azure/app-configuration
26```
27
28## Key concepts
29
30### Configuration Setting
31
32A Configuration Setting is the fundamental resource within a Configuration Store.
33In its simplest form, it is a key and a value. However, there are additional properties such as
34the modifiable content type and tags fields that allows the value to be interpreted or associated
35in different ways.
36
37The `label` property of a Configuration Setting provides a way to separate configuration settings
38into different dimensions. These dimensions are user defined and can take any form. Some common
39examples of dimensions to use for a label include regions, semantic versions, or environments.
40Many applications have a required set of configuration keys that have varying values as the
41application exists across different dimensions.
42
43For example, MaxRequests may be 100 in "NorthAmerica", and 200 in "WestEurope". By creating a
44Configuration Setting named MaxRequests with a label of "NorthAmerica" and another, only with
45a different value, in the "WestEurope" label, an application can seamlessly retrieve
46Configuration Settings as it runs in these two dimensions.
47
48## Examples
49
50#### nodejs - Authentication, client creation and listConfigurationSettings as an example written in TypeScript.
51
52##### Sample code
53
54```typescript
55import { AppConfigurationClient } from "@azure/app-configuration";
56
57const connectionString = process.env["AZ_CONFIG_CONNECTION"]!;
58const client = new AppConfigurationClient(connectionString);
59
60let configurationSetting = await client.getConfigurationSetting("testkey");
61
62console.log("The result is:");
63console.log(configurationSetting.value);
64```
65
66More examples can be found in the samples folder on [github](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/appconfiguration/app-configuration/samples)
67
68## Next steps
69
70Explore the samples to understand how to work with Azure App Configuration.
71
72* [`helloworld.ts`](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/appconfiguration/app-configuration/samples/helloworld.ts) - getting, setting and deleting configuration values
73* [`helloworldWithLabels.ts`](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/appconfiguration/app-configuration/samples/helloworldWithLabels.ts) - using labels to add additional dimensions to your settings
74* [`helloworldWithETag.ts`](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/appconfiguration/app-configuration/samples/helloworldWithETag.ts) - setting values using etags to prevent accidental overwrites
75
76## Contributing
77
78This project welcomes contributions and suggestions. Most contributions require you to agree to a
79Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
80the rights to use your contribution. For details, visit <https://cla.microsoft.com.>
81
82When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
83a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
84provided by the bot. You will only need to do this once across all repos using our CLA.
85
86If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/master/CONTRIBUTING.md) to learn more about how to build and test the code.
87
88This module's tests are live tests, which require you to have an Azure App Configuration instance. To execute the tests
89you'll need to run:
901. `rush update`
912. `rush build`
923. `npm run test`.
93
94View our tests ([index.spec.ts](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/appconfiguration/app-configuration/test/index.spec.ts)) for more details.
95
96## Related projects
97
98- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
99
100![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/appconfiguration/app-config/README.png)