Skip to content

Commit 6873a45

Browse files
committed
fix(build): package lock and readme updates
1 parent 008df2c commit 6873a45

File tree

2 files changed

+38
-7
lines changed

2 files changed

+38
-7
lines changed

README.md

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,67 @@
88
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?clear)](http://commitizen.github.io/cz-cli/)
99
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
1010

11-
LaunchDarkly (https://launchdarkly.com/) provides SaaS based Feature Flag management at scale, with SDKs for all major Languages.
11+
LaunchDarkly (https://launchdarkly.com/) provides SaaS based Feature Flag management at scale, with SDKs for all major languages.
1212

1313
This unofficial module provides NodeJs functions wrapping the LaunchDarkly API. This is not the sdk for implementing flags in your app - it is the api to manage your account/flags.
1414

1515
## Why?
1616
There does not appear to be a project currently providing a simple interface to manage flags in LaunchDarkly via API in nodejs.
1717

1818
## How?
19-
There is a swagger.yaml available to generate bindings (https://launchdarkly.github.io/ld-openapi/swagger.yaml). Uses the swagger-js module to generate a client (https://github.com/swagger-api/swagger-js), and adds some extra features around logging and input validation.
19+
There is a swagger.yaml available to generate bindings (https://launchdarkly.github.io/ld-openapi/swagger.yaml), so we use the swagger-js module to generate a client (https://github.com/swagger-api/swagger-js), and add some extra features around logging and chaining of operations.
2020

2121
## Install
22-
`npm install launchdarkly-nodeutils --save`
22+
1. `npm install launchdarkly-nodeutils --save`
23+
2. Generate an access token with the permissions for the operations you will use. Please read: https://docs.launchdarkly.com/v2.0/docs/api-access-tokens
2324

2425
## Example usage
25-
Note that the api token is not the same as your sdk keys. You need to generate this for your account in LaunchDarkly console.
26+
Please note that the api token is not the same as your sdk keys. You need to generate this for your account in LaunchDarkly console as above, and set it as the LAUNCHDARKLY_API_TOKEN env var.
2627

2728
### commandline usage
29+
Command line support is primarily for debugging api calls.
2830
```
2931
export LAUNCHDARKLY_API_TOKEN=<api-token>
30-
npm run api getFlags <myProjectId>
32+
33+
// collect all flags for a project
34+
npm run api -- getFeatureFlags <myProjectId>
35+
36+
// update or create a customRole with array of policies
37+
npm run api -- upsertCustomRole <customRoleKey> <customRoleName> '[{"resources":["proj/*"],"actions":["*"],"effect":"allow"}]'
3138
```
3239

3340
### node app usage
41+
Assumes that you have set the LAUNCHDARKLY_API_TOKEN environment var.
3442
```
3543
let ldUtils = await new LaunchDarklyUtils().create(process.env.LAUNCHDARKLY_API_TOKEN);
3644
3745
// get flag state
3846
let flagEnabled = await ldUtils.getFeatureFlagState('myProject', 'feature-abc', 'dev');
3947
4048
// update flag state to on=true
41-
await ldUtils.toggleFeatureFlag(proj'myProject', 'feature-def', 'dev', true);
49+
await ldUtils.toggleFeatureFlag('myProject', 'feature-def', 'dev', true);
4250
```
51+
52+
## commandline modes and parameters
53+
The command line modes and parameters map directly to the functions exposed for use in nodejs apps.
54+
55+
### Feature flags
56+
57+
| Mode | parameters |
58+
| ---- | ---------- |
59+
| getFeatureFlags | projectKey |
60+
| getFeatureFlag | projectKey, featureFlagKey, environmentKeyQuery |
61+
| getFeatureFlagState | projectKey, featureFlagKey, environmentKeyQuery |
62+
| toggleFeatureFlag | projectKey, featureFlagKey, environmentKeyQuery, enabled |
63+
64+
### Custom roles
65+
66+
| Mode | parameters |
67+
| ---- | ---------- |
68+
| getCustomRoles | none |
69+
| getCustomRole | customRoleKey |
70+
| createCustomRole | createCustomRole |
71+
| updateCustomRole | customRoleKey, customRoleName, customRolePolicyArray, customRoleDescription(optional) |
72+
| upsertCustomRole | customRoleKey, customRoleName, customRolePolicyArray, customRoleDescription(optional) |
73+
74+
For details on role policy object structures, please see: https://docs.launchdarkly.com/docs/custom-roles

package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)