@openfeature/flagd-provider 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -16
- package/index.cjs +877 -882
- package/index.js +835 -837
- package/lib/configuration.d.ts +33 -0
- package/lib/flagd-provider.d.ts +9 -13
- package/lib/service/grpc/service.d.ts +9 -12
- package/lib/service/service.d.ts +7 -0
- package/package.json +2 -3
- package/lib/service/Service.d.ts +0 -7
- package/lib/service/http/service.d.ts +0 -16
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Server-side JavaScript flagd Provider for OpenFeature
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
5
|
-
Flagd is a simple
|
|
5
|
+
Flagd is a simple daemon for evaluating feature flags.
|
|
6
|
+
It is designed to conform to OpenFeature schema for flag definitions.
|
|
7
|
+
This repository and package provides the client code for interacting with it via the OpenFeature server-side JavaScript SDK.
|
|
6
8
|
|
|
7
9
|
## Installation
|
|
8
10
|
|
|
@@ -10,29 +12,43 @@ Flagd is a simple command line tool for fetching and presenting feature flags to
|
|
|
10
12
|
$ npm install @openfeature/flagd-provider
|
|
11
13
|
```
|
|
12
14
|
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
Run `nx package providers-flagd` to build the library.
|
|
16
|
-
|
|
17
|
-
> NOTE: [Buf](https://docs.buf.build/installation) must be installed to build locally.
|
|
15
|
+
## Usage
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
The `FlagdProvider` supports multiple configuration options that determine now the SDK communicates with flagd.
|
|
18
|
+
Options can be defined in the constructor or as environment variables, with constructor options having the highest precedence.
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
### Available options
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
| Option name | Environment variable name | Type | Default |
|
|
23
|
+
| ----------- | ------------------------- | ------- | --------- |
|
|
24
|
+
| host | FLAGD_HOST | string | localhost |
|
|
25
|
+
| port | FLAGD_PORT | number | 8013 |
|
|
26
|
+
| tls | FLAGD_TLS | boolean | false |
|
|
27
|
+
| socketPath | FLAGD_SOCKET_PATH | string | - |
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
### Example using TCP
|
|
26
30
|
|
|
27
31
|
```
|
|
28
32
|
OpenFeature.setProvider(new FlagdProvider({
|
|
29
|
-
service: 'grpc',
|
|
30
33
|
host: 'localhost',
|
|
31
34
|
port: 8013,
|
|
32
35
|
}))
|
|
33
36
|
```
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
### Example using a Unix socket
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
OpenFeature.setProvider(new FlagdProvider({
|
|
42
|
+
socketPath: "/tmp/flagd.socks",
|
|
43
|
+
}))
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Building
|
|
47
|
+
|
|
48
|
+
Run `nx package providers-flagd` to build the library.
|
|
49
|
+
|
|
50
|
+
> NOTE: [Buf](https://docs.buf.build/installation) must be installed to build locally.
|
|
51
|
+
|
|
52
|
+
## Running unit tests
|
|
53
|
+
|
|
54
|
+
Run `nx test providers-flagd` to execute the unit tests via [Jest](https://jestjs.io).
|