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
@@ -16,12 +16,33 @@ This unofficial module provides NodeJs functions wrapping the LaunchDarkly API.
16
16
We need a way to manage flags as part of CI/CD pipelines, and there is not another project currently providing a simple interface to manage flags and other objects in LaunchDarkly via API in nodejs.
17
17
18
18
## How?
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, error handling, and chaining of operations.
19
+
There is an openapi spec available to generate bindings (https://launchdarkly.github.io/ld-openapi/openapi.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, error handling, and chaining of operations.
20
20
In addition we expose apis as a commandline tool.
21
21
22
22
## Install
23
-
1.`npm install launchdarkly-nodeutils --save` or clone this repo.
24
-
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
23
+
1.`npm install launchdarkly-nodeutils -g` (this will install the `ldutils` command).
24
+
1. 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
25
+
1. export your api token `export LAUNCHDARKLY_API_TOKEN=<api-token>`
26
+
1. run `ldutils` to confirm your installation was successful - you should see usage instructions.
27
+
28
+
The installation instructions above should be all you need to do. Alternatively, you can clone this repo and install manually.
29
+
30
+
After cloning this repo:
31
+
1. run `yarn build`
32
+
1. check that `ldutils` is executable and run it:
33
+
```
34
+
chmod 755 ./ldutils
35
+
./ldutils
36
+
```
37
+
38
+
The above will display a help screen of instructions, thanks to https://github.com/tj/commander.js/
39
+
40
+
Optionally you can add `ldutils` to your PATH, or symlink in a directory already in your path:
> Make sure you have env var LAUNCHDARKLY_API_TOKEN set, and if piping output to another command, ensure that LAUNCHDARKLY_API_LOGLEVEL is not set to 'debug' to ensure only the json result of the command is returned.
25
46
26
47
## Use cases
27
48
The command line tool or nodejs module can be used for many things. Here are some examples.
@@ -51,29 +72,8 @@ Copying flag attributes from prod back to preprod for testing. Also newly create
51
72
52
73
53
74
## Command line usage
54
-
After cloning this repo you can make `ldutils` executable, and use it to make api calls based on passed in parameters.
55
-
56
-
> please read the [API documentation](API.md) for examples.
57
-
58
-
```
59
-
chmod 755 ./ldutils
60
-
./ldutils
61
-
```
62
-
63
-
The above will display a help screen of instructions, thanks to https://github.com/tj/commander.js/
> Make sure you have env var LAUNCHDARKLY_API_TOKEN set, and if piping output to another command, ensure that LAUNCHDARKLY_API_LOGLEVEL is not set to 'debug' to ensure only the json result of the command is returned.
75
75
76
-
Here are some examples of commandline usage (if you have not added ldutils to PATH, prefix with `./`:
76
+
Here are some examples of commandline usage - see below for all available command modes:
0 commit comments