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
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->
## This PR
<!-- add the description of the PR here -->
Adds examples for named providers, events and the global shutdown of
spec 0.6.0.
It does not provide an example for flag metadata, as I think an example
is not needed here.
### Related Issues
<!-- add here the GitHub issue that this PR resolves if applicable -->
Fixes#440
### Notes
<!-- any additional notes for this PR -->
### Follow-up Tasks
<!-- anything that is related to this PR but not done here should be
noted under this section -->
<!-- if there is a need for a new issue, please link it here -->
### How to test
<!-- if applicable, add testing instructions under this section -->
---------
Signed-off-by: Lukas Reining <lukas.reining@codecentric.de>
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Copy file name to clipboardExpand all lines: packages/client/README.md
+78-8Lines changed: 78 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@
11
11
12
12
[](https://www.repostatus.org/#wip)
@@ -22,11 +22,14 @@ For more information, see this [issue](https://github.com/open-feature/spec/issu
22
22
23
23
### What is OpenFeature?
24
24
25
-
[OpenFeature][openfeature-website] is an open standard that provides a vendor-agnostic, community-driven API for feature flagging that works with your favorite feature flag management tool.
25
+
[OpenFeature][openfeature-website] is an open standard that provides a vendor-agnostic, community-driven API for feature
26
+
flagging that works with your favorite feature flag management tool.
26
27
27
28
### Why standardize feature flags?
28
29
29
-
Standardizing feature flags unifies tools and vendors behind a common interface which avoids vendor lock-in at the code level. Additionally, it offers a framework for building extensions and integrations and allows providers to focus on their unique value proposition.
30
+
Standardizing feature flags unifies tools and vendors behind a common interface which avoids vendor lock-in at the code
31
+
level. Additionally, it offers a framework for building extensions and integrations and allows providers to focus on
Sometimes the value of a flag must take into account some dynamic criteria about the application or user, such as the user location, IP, email address, or the location of the server.
78
+
Sometimes the value of a flag must take into account some dynamic criteria about the application or user, such as the
79
+
user location, IP, email address, or the location of the server.
76
80
In OpenFeature, we refer to this as [`targeting`](https://openfeature.dev/specification/glossary#targeting).
77
81
If the flag system you're using supports targeting, you can provide the input data using the `EvaluationContext`.
To develop a provider, you need to create a new project and include the OpenFeature SDK as a dependency. This can be a new repository or included in an existing contrib repository available under the OpenFeature organization. Finally, you’ll then need to write the provider itself. In most languages, this can be accomplished by implementing the provider interface exported by the OpenFeature SDK.
93
+
To develop a provider, you need to create a new project and include the OpenFeature SDK as a dependency. This can be a
94
+
new repository or included in an existing contrib repository available under the OpenFeature organization. Finally,
95
+
you’ll then need to write the provider itself. In most languages, this can be accomplished by implementing the provider
@@ -118,7 +125,9 @@ See [here](https://openfeature.dev/docs/reference/technologies/server/javascript
118
125
119
126
### Hooks:
120
127
121
-
Hooks are a mechanism that allow for the addition of arbitrary behavior at well-defined points of the flag evaluation life-cycle. Use cases include validation of the resolved flag value, modifying or adding data to the evaluation context, logging, telemetry, and tracking.
128
+
Hooks are a mechanism that allow for the addition of arbitrary behavior at well-defined points of the flag evaluation
129
+
life-cycle. Use cases include validation of the resolved flag value, modifying or adding data to the evaluation context,
@@ -136,20 +145,24 @@ See [here](https://openfeature.dev/docs/reference/technologies/server/javascript
136
145
137
146
### Logging:
138
147
139
-
You can implement the `Logger` interface (compatible with the `console` object, and implementations from common logging libraries such as [winston](https://www.npmjs.com/package/winston)) and set it on the global API object.
148
+
You can implement the `Logger` interface (compatible with the `console` object, and implementations from common logging
149
+
libraries such as [winston](https://www.npmjs.com/package/winston)) and set it on the global API object.
140
150
141
151
```typescript
142
152
// implement logger
143
153
classMyLoggerimplementsLogger {
144
154
error(...args:unknown[]):void {
145
155
// implement me
146
156
}
157
+
147
158
warn(...args:unknown[]):void {
148
159
// implement me
149
160
}
161
+
150
162
info(...args:unknown[]):void {
151
163
// implement me
152
164
}
165
+
153
166
debug(...args:unknown[]):void {
154
167
// implement me
155
168
}
@@ -159,6 +172,63 @@ class MyLogger implements Logger {
159
172
OpenFeature.setLogger(newMyLogger());
160
173
```
161
174
175
+
### Named clients:
176
+
177
+
You can have several clients, that can be referenced by a name.
178
+
Every client can have a different provider assigned. If no provider is assigned to a named client, the global default
Copy file name to clipboardExpand all lines: packages/server/README.md
+58-1Lines changed: 58 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@
11
11
12
12
[](https://www.repostatus.org/#active)
0 commit comments