@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 CHANGED
@@ -1,8 +1,10 @@
1
- # NodeJS flagd Provider for OpenFeature
1
+ # Server-side JavaScript flagd Provider for OpenFeature
2
2
 
3
3
  ![Experimental](https://img.shields.io/badge/experimental-breaking%20changes%20allowed-yellow)
4
4
 
5
- Flagd is a simple command line tool for fetching and presenting feature flags to services. It is designed to conform to OpenFeature schema for flag definitions. This repository and package provides the client side code for interacting with it via the Open-Feature Node SDK.
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
- ## Building
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
- ## Running unit tests
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
- Run `nx test providers-flagd` to execute the unit tests via [Jest](https://jestjs.io).
20
+ ### Available options
22
21
 
23
- ## Usage
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
- The `FlagdProvider` client constructor takes a single optional argument with 3 fields, their default values correspond to the default arguments supplied to the flagd server:
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
- **service**: "http" | "grpc" _(defaults to http)_
36
- **host**: string _(defaults to "localhost")_
37
- **port**: number _(defaults to 8013)_
38
- **protocol**: "http" | "https" _(defaults to http - only active for http service)_
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).