Skip to content

Commit 32a0799

Browse files
authored
Update README.md and SUPPORT.md (#9)
1 parent 53fdca1 commit 32a0799

File tree

2 files changed

+60
-25
lines changed

2 files changed

+60
-25
lines changed

README.md

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,63 @@
1-
# Project
1+
# Microsoft Feature Management for JavaScript
22

3-
> This repo has been populated by an initial template to help get you started. Please
4-
> make sure to update the content to build a great experience for community-building.
3+
Feature Management is a library for enabling/disabling features at runtime.
4+
Developers can use feature flags in simple use cases like conditional statement to more advanced scenarios like conditionally adding routes.
55

6-
As the maintainer of this project, please make a few updates:
6+
## Getting Started
77

8-
- Improving this README.MD file to provide a great experience
9-
- Updating SUPPORT.MD with content about this project's support experience
10-
- Understanding the security reporting process in SECURITY.MD
11-
- Remove this section from the README
8+
### Prerequisites
9+
10+
- Node.js LTS version
11+
12+
### Usage
13+
14+
You can use feature flags from the Azure App Configuration service, local files or any other sources.
15+
16+
#### Use feature flags from Azure App Configuration
17+
18+
The App Configuration JavaScript provider provides feature flags in as a `Map` object.
19+
A builtin `ConfigurationMapFeatureFlagProvider` helps to load feature flags in this case.
20+
21+
```js
22+
const appConfig = load(connectionString, {featureFlagOptions}); // load feature flags from Azure App Configuration service
23+
const featureProvider = new ConfigurationMapFeatureFlagProvider(appConfig);
24+
const featureManager = new FeatureManager(featureProvider);
25+
const isAlphaEnabled = await featureManager.isEnabled("Alpha");
26+
console.log("Feature Alpha is:", isAlphaEnabled);
27+
```
28+
29+
#### Use feature flags from a json file
30+
31+
A sample JSON file with the following format can be used to load feature flags.
32+
The JSON file can be read and parsed as an object as a whole.
33+
A builtin `ConfigurationObjectFeatureFlagProvider` helps to load feature flags in this case.
34+
35+
Content of `sample.json`:
36+
```json
37+
{
38+
"feature_management": {
39+
"feature_flags": [
40+
{
41+
"id": "Alpha",
42+
"description": "",
43+
"enabled": "true",
44+
"conditions": {
45+
"client_filters": []
46+
}
47+
}
48+
]
49+
}
50+
}
51+
```
52+
53+
Load feature flags from `sample.json` file.
54+
```js
55+
const config = JSON.parse(await fs.readFile("path/to/sample.json"));
56+
const featureProvider = new ConfigurationObjectFeatureFlagProvider(config);
57+
const featureManager = new FeatureManager(featureProvider);
58+
const isAlphaEnabled = await featureManager.isEnabled("Alpha");
59+
console.log("Feature Alpha is:", isAlphaEnabled);
60+
```
1261

1362
## Contributing
1463

SUPPORT.md

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
1-
# TODO: The maintainer of this repo has not yet edited this file
2-
3-
**REPO OWNER**: Do you want Customer Service & Support (CSS) support for this product/project?
4-
5-
- **No CSS support:** Fill out this template with information about how to file issues and get help.
6-
- **Yes CSS support:** Fill out an intake form at [aka.ms/onboardsupport](https://aka.ms/onboardsupport). CSS will work with/help you to determine next steps.
7-
- **Not sure?** Fill out an intake as though the answer were "Yes". CSS will help you decide.
8-
9-
*Then remove this first heading from this SUPPORT.MD file before publishing your repo.*
10-
111
# Support
122

13-
## How to file issues and get help
3+
## How to file issues and get help
144

155
This project uses GitHub Issues to track bugs and feature requests. Please search the existing
166
issues before filing new issues to avoid duplicates. For new issues, file your bug or
177
feature request as a new Issue.
188

19-
For help and questions about using this project, please **REPO MAINTAINER: INSERT INSTRUCTIONS HERE
20-
FOR HOW TO ENGAGE REPO OWNERS OR COMMUNITY FOR HELP. COULD BE A STACK OVERFLOW TAG OR OTHER
21-
CHANNEL. WHERE WILL YOU HELP PEOPLE?**.
22-
23-
## Microsoft Support Policy
9+
## Microsoft Support Policy
2410

25-
Support for this **PROJECT or PRODUCT** is limited to the resources listed above.
11+
Support for this project is limited to the resources listed above.

0 commit comments

Comments
 (0)