Skip to content

Commit 152c48c

Browse files
committed
pass inmemoryflags through to configuration
1 parent 78947b1 commit 152c48c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/main/java/io/github/sideshowcoder/dropwizard_openfeature/OpenFeatureBundle.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package io.github.sideshowcoder.dropwizard_openfeature;
22

3+
import dev.openfeature.sdk.providers.memory.Flag;
34
import io.dropwizard.core.ConfiguredBundle;
45
import io.dropwizard.core.setup.Environment;
56

7+
import java.util.Map;
8+
69
/**
710
* TODO tests for OpenFeatureBundle integration into a Dropwizard Application
811
* TODO tests for configured flagd provider with flags serverd from offlineflagspath
@@ -14,8 +17,20 @@
1417
* TODO get listed in openfeature.dev
1518
*/
1619
public class OpenFeatureBundle implements ConfiguredBundle<OpenFeatureBundleConfiguration> {
20+
21+
private final Map<String, Flag<?>> inMemoryFlags;
22+
23+
public OpenFeatureBundle() {
24+
this(Map.of());
25+
}
26+
27+
public OpenFeatureBundle(Map<String, Flag<?>> inMemoryFlags) {
28+
this.inMemoryFlags = inMemoryFlags;
29+
}
30+
1731
@Override
1832
public void run(OpenFeatureBundleConfiguration configuration, Environment environment) {
33+
configuration.getOpenFeatureBundleFactory().setFlags(inMemoryFlags);
1934
configuration.getOpenFeatureBundleFactory().startOpenFeatureAPIManager(environment);
2035
configuration.getOpenFeatureBundleFactory().registerOpenFeatureHealthCheck(environment);
2136
}

0 commit comments

Comments
 (0)