Skip to content

Commit c6c3222

Browse files
committed
fill in readme
1 parent 04ae2d4 commit c6c3222

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Dropwizard Openfeature
2+
3+
This plugin integrates [openfeature](https://openfeature.dev/) with dropwizard and allows you to use openfeature feature
4+
flags, provided by supported openfeature providers via a managed `OpenFeatureAPI` instance.
5+
6+
Currently only [flagd](https://flagd.dev/) and the SDKs
7+
[InMemoryProvider](https://github.com/open-feature/java-sdk/blob/main/src/main/java/dev/openfeature/sdk/providers/memory/InMemoryProvider.java)
8+
providers are supported
9+
10+
## Installing the bundle from source code
11+
12+
```
13+
git clone https://github.com/sideshowcoder/dropwizard-openfeature
14+
cd dropwizard-openfeature
15+
./mvn install
16+
```
17+
18+
After installing the plugin locally you can include it in your pom.xml
19+
20+
```xml
21+
<dependency>
22+
<groupId>io.github.sideshowcoder</groupId>
23+
<artifactId>dropwizard-openfeature</artifactId>
24+
<version>$VERSION</version>
25+
</dependency>
26+
```
27+
28+
## Included in the bundle
29+
30+
### Supported providers
31+
32+
The bundle currently supports both the SDK included `InMemoryProvider` as well as `flagd`, the provider can be selected
33+
via the configuration. For details on the configuration options see `FlagdConfiguration` as well the
34+
[flagd documentation](https://flagd.dev/providers/java/).
35+
36+
### OpenFeatureAPI management
37+
38+
The initialized `OpenFeatureAPI` is managed via the dropwizard lifecycle.
39+
40+
### Healthcheck
41+
42+
By default the bundle registers a healthcheck on the state of the provider configured, this healthcheck can be further
43+
configured via the `OpenFeatureHealthCheckConfiguration`.
44+
45+
## Activating the bundle: Configuration
46+
47+
Your Dropwizard application configuration class must implement `OpenFeatureBundleConfiguration`:
48+
49+
## Configuring dropwizard-openfeature in the dropwizard config file
50+
51+
For a full overview see `OpenFeatureBundleFactory`, `OpenFeatureHealthCheckConfiguration`, and `FlagdConfiguration` a
52+
minimal configuration for flagd runnining locally on the port 8013 would look as follows.
53+
54+
```yaml
55+
openfeature:
56+
provider: flagd
57+
flagd:
58+
host: localhost
59+
port: 8013
60+
```
61+
62+
For the bundle to have access to the configuration, your application configuration needs to implement
63+
`OpenFeatureBundleConfiguration`.
64+
65+
```java
66+
public class ApplicationConfiguration implements OpenFeatureBundleConfiguration {
67+
68+
@Valid
69+
@NotNull
70+
@JsonProperty
71+
private OpenFeatureBundleFactory openfeature;
72+
73+
@Override
74+
public OpenFeatureBundleFactory getOpenFeatureBundleFactory() {
75+
return openfeature;
76+
}
77+
}
78+
```
79+
80+
## Activating the bundle: Initialization
81+
82+
In your application's `initialize` method, call `bootstrap.addBundle(new OpenFeatureBundle())`:
83+
84+
```java
85+
import io.github.sideshowcoder.dropwizard_openfeature.OpenFeatureBundle;
86+
87+
@Override
88+
public void initialize(Bootstrap<MyConfiguration> bootstrap) {
89+
bootstrap.addBundle(new OpenFeatureBundle());
90+
}
91+
```
92+
93+
# Contributors
94+
* [Philipp Fehre](https://github.com/sideshowcoder)

0 commit comments

Comments
 (0)