From b5fe096b68d43c42330fb24b2b191ea6db376273 Mon Sep 17 00:00:00 2001 From: Philipp Fehre Date: Mon, 17 Nov 2025 22:04:57 +0100 Subject: [PATCH 1/2] implement ofrep provider support --- README.md | 78 +++++++++++++------ pom.xml | 9 ++- .../GoFeatureFlagConfiguration.java | 8 ++ .../OfrepConfiguration.java | 50 ++++++++++++ .../OpenFeatureBundle.java | 5 +- .../OpenFeatureConfiguration.java | 12 +++ .../dropwizard_openfeature/ProviderType.java | 1 + ...eatureBundleGoFeatureFlagProviderTest.java | 22 +----- .../OpenFeatureBundleOfrepProviderTest.java | 49 ++++++++++++ .../helpers/GoFeatureFlagContainer.java | 47 +++++++++++ src/test/resources/ofrep-config.yml | 5 ++ src/test/resources/ofrep-provider-config.yml | 6 ++ 12 files changed, 246 insertions(+), 46 deletions(-) create mode 100644 src/main/java/io/github/sideshowcoder/dropwizard_openfeature/OfrepConfiguration.java create mode 100644 src/test/java/io/github/sideshowcoder/dropwizard_openfeature/OpenFeatureBundleOfrepProviderTest.java create mode 100644 src/test/java/io/github/sideshowcoder/dropwizard_openfeature/helpers/GoFeatureFlagContainer.java create mode 100644 src/test/resources/ofrep-config.yml create mode 100644 src/test/resources/ofrep-provider-config.yml diff --git a/README.md b/README.md index 9dadd66..950e756 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,19 @@ -[![Maven Central](https://maven-badges.sml.io/sonatype-central/io.github.sideshowcoder/dropwizard-openfeature/badge.svg?version=2.0.0)](https://maven-badges.sml.io/sonatype-central/io.github.sideshowcoder/dropwizard-openfeature) ![Maven Test & Build](https://github.com/sideshowcoder/dropwizard-openfeature/actions/workflows/maven-build.yml/badge.svg) +[![Maven Central](https://maven-badges.sml.io/sonatype-central/io.github.sideshowcoder/dropwizard-openfeature/badge.svg?version=2.1.0)](https://maven-badges.sml.io/sonatype-central/io.github.sideshowcoder/dropwizard-openfeature) ![Maven Test & Build](https://github.com/sideshowcoder/dropwizard-openfeature/actions/workflows/maven-build.yml/badge.svg) # Dropwizard Openfeature -This plugin integrates [openfeature][1] with dropwizard and allows you to use openfeature feature -flags, provided by supported openfeature providers via a managed `OpenFeatureAPI` instance. +This plugin integrates [openfeature][1] with dropwizard and allows you to use +openfeature feature flags, provided by supported openfeature providers via a +managed `OpenFeatureAPI` instance. -Currently only [flagd][2] and the SDKs [InMemoryProvider][3] providers are supported +It implements support for +- [InMemoryProvider][3] useful for testing +- [flagd][2] +- [GO Feature Flag][6] +- [OpenFeature Remote Evaluation Protocol (OFREP)][8] to support any providers implementing it + +Currently only [flagd][2] and the SDKs [InMemoryProvider][3] providers are +supported ## Installing the bundle @@ -17,7 +25,7 @@ Currently only [flagd][2] and the SDKs [InMemoryProvider][3] providers are suppo io.github.sideshowcoder dropwizard-openfeature - 2.0.0 + 2.1.0 ``` @@ -35,29 +43,38 @@ After installing the plugin locally you can include it in your `pom.xml` io.github.sideshowcoder dropwizard-openfeature - 2.0.1-SNAPSHOT + 2.1.1-SNAPSHOT ``` - - ## Included in the bundle ### Supported providers -The bundle currently supports both the SDK included `InMemoryProvider` as well as `flagd`, the provider can be selected -via the configuration. For details on the configuration options see `FlagdConfiguration` as well the -[flagd documentation][5]. +Currently the following providers, implemented in the +[open-feature/java-sdk-contrib][11] are supported, and their respective most +used configuration options are mapped to yaml configuration. Addtional +configuration can be set by accessing the underlying provider as needed. + +- [InMemoryProvider][3] +- [flagd][9] +- [GO Feature Flag][10] +- [OpenFeature Remote Evaluation Protocol (OFREP)][7] to support any providers + implementing it + +For the configuration see the respective configuration classes. ### OpenFeatureAPI management -The initialized `OpenFeatureAPI` is managed via the dropwizard lifecycle and will be shutdown gracefully upon -application shutdown, see `OpenFeatureAPIManager`. +The initialized `OpenFeatureAPI` is managed via the dropwizard lifecycle and +will be shutdown gracefully upon application shutdown, see +`OpenFeatureAPIManager`. ### Healthcheck -By default the bundle registers a healthcheck on the state of the provider configured, this healthcheck can be further -configured via the `OpenFeatureHealthCheckConfiguration`. +By default the bundle registers a healthcheck on the state of the provider +configured, this healthcheck can be further configured via the +`OpenFeatureHealthCheckConfiguration`. ## Activating the bundle @@ -65,8 +82,10 @@ Your Dropwizard application configuration class must implement `OpenFeatureBundl ### Configuring dropwizard-openfeature in the dropwizard config file -For a full overview see `OpenFeatureConfiguration`, `OpenFeatureHealthCheckConfiguration`, and `FlagdConfiguration` a -minimal configuration for flagd runnining locally on the port 8013 would look as follows. +For a full overview see `OpenFeatureConfiguration`, +`OpenFeatureHealthCheckConfiguration`, and the respective provider specific +configuration. A minimal configuration for flagd runnining locally on the port +8013 would look as follows. ```yaml openfeature: @@ -76,8 +95,8 @@ openfeature: port: 8013 ``` -For the bundle to have access to the configuration, your application configuration needs to implement -`OpenFeatureBundleConfiguration`. +For the bundle to have access to the configuration, your application +configuration needs to implement `OpenFeatureBundleConfiguration`. ```java public class Config extends Configuration implements OpenFeatureBundleConfiguration { @@ -96,7 +115,8 @@ public class Config extends Configuration implements OpenFeatureBundleConfigurat ### Initialization -In your application's `initialize` method, call `bootstrap.addBundle(new OpenFeatureBundle())`: +In your application's `initialize` method, call `bootstrap.addBundle(new +OpenFeatureBundle())`: ```java public class App extends Application { @@ -115,9 +135,10 @@ public class App extends Application { ### Using the client -OpenFeature configures a global `OpenFeatureAPI` which grants access to a client, which can be injected as needed, it is -common practise to provide a domain as an identifier, this is however not required, unless multiple clients are to be -created. +OpenFeature configures a global `OpenFeatureAPI` which grants access to a +client, which can be injected as needed, it is common practise to provide a +domain as an identifier, this is however not required, unless multiple clients +are to be created. ```java public class App extends Application { @@ -144,8 +165,9 @@ public class App extends Application { ### Accessing the underlying feature provider -The bundle exposes access to the underlying feature provider. Useful for runtime configuration and introspection of the -provider. For example when using the `InMemoryProvider` flags can be updated at runtime for example for testing. +The bundle exposes access to the underlying feature provider. Useful for runtime +configuration and introspection of the provider. For example when using the +`InMemoryProvider` flags can be updated at runtime for example for testing. ```java public class App extends Application { @@ -177,3 +199,9 @@ public class App extends Application { [3]: https://github.com/open-feature/java-sdk/blob/main/src/main/java/dev/openfeature/sdk/providers/memory/InMemoryProvider.java [4]: https://central.sonatype.com/artifact/io.github.sideshowcoder/dropwizard-openfeature [5]: https://flagd.dev/providers/java/ +[6]: https://gofeatureflag.org +[7]: https://github.com/open-feature/java-sdk-contrib/tree/main/providers/ofrep +[8]: https://openfeature.dev/docs/reference/other-technologies/ofrep/ +[9]: https://github.com/open-feature/java-sdk-contrib/tree/main/providers/flagd +[10]: https://github.com/open-feature/java-sdk-contrib/tree/main/providers/go-feature-flag +[11]: https://github.com/open-feature/java-sdk-contrib diff --git a/pom.xml b/pom.xml index e1e2ad8..60ab123 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.github.sideshowcoder dropwizard-openfeature - 2.0.1-SNAPSHOT + 2.1.0 jar dropwizard-openfeature @@ -23,6 +23,7 @@ 1.20.1 0.11.20 1.1.1 + 0.0.1 0.8.14 3.15.0 3.2.8 @@ -116,6 +117,7 @@ sdk ${openfeature-sdk.version} + dev.openfeature.contrib.providers flagd @@ -126,6 +128,11 @@ go-feature-flag ${openfeature-contrib-providers-go-feature-flag.version} + + dev.openfeature.contrib.providers + ofrep + ${openfeature-contrib-providers-ofrep.version} + io.dropwizard diff --git a/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/GoFeatureFlagConfiguration.java b/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/GoFeatureFlagConfiguration.java index 864b8c2..123d4cd 100644 --- a/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/GoFeatureFlagConfiguration.java +++ b/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/GoFeatureFlagConfiguration.java @@ -7,6 +7,14 @@ import dev.openfeature.contrib.providers.gofeatureflag.exception.InvalidOptions; import jakarta.validation.constraints.NotNull; +/** + * Maps the {@link GoFeatureFlagConfiguration} confiuration in yaml to the actual {@link GoFeatureFlagProviderOptions }. + * + * Supported options + * + * Name | Type | example | required | description + * endpoit | String | http://localhost:8016 | yes | endpoint to reach the GoFeatureFlag relay proxy + */ public class GoFeatureFlagConfiguration { @JsonProperty diff --git a/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/OfrepConfiguration.java b/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/OfrepConfiguration.java new file mode 100644 index 0000000..0f3d6b5 --- /dev/null +++ b/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/OfrepConfiguration.java @@ -0,0 +1,50 @@ +package io.github.sideshowcoder.dropwizard_openfeature; + +import java.time.Duration; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import dev.openfeature.contrib.providers.ofrep.OfrepProviderOptions; +import jakarta.validation.constraints.NotNull; + +/** + * Maps the ofrep confiuration in yaml to the actual {@link OfrepProviderOptions}. + * + * Supported options + * + * Name | Type | example | required | description + * baseurl | String | http://localhost:8016 | yes | baseurl for the ofrep protocol to use + * timeout | long | 500 | no | request timeout in millis + * threadcount | int | 5 | no | thread pool size for the http client + */ +public class OfrepConfiguration { + + @JsonProperty + @NotNull + private String baseurl; + + @JsonProperty + private long timeout; + + @JsonProperty + private int threadcount; + + public OfrepProviderOptions getOfrepProviderOptions() { + OfrepProviderOptions.Builder builder = OfrepProviderOptions.builder().baseUrl(baseurl); + + if (timeout != 0) { + Duration requestTimeout = Duration.ofMillis(timeout); + builder.requestTimeout(requestTimeout); + } + + if (threadcount != 0) { + Executor executor = Executors.newFixedThreadPool(threadcount); + builder.executor(executor); + } + + return builder.build(); + } +} + diff --git a/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/OpenFeatureBundle.java b/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/OpenFeatureBundle.java index 9aa31d9..1240bee 100644 --- a/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/OpenFeatureBundle.java +++ b/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/OpenFeatureBundle.java @@ -2,8 +2,8 @@ import dev.openfeature.contrib.providers.flagd.FlagdProvider; import dev.openfeature.contrib.providers.gofeatureflag.GoFeatureFlagProvider; -import dev.openfeature.contrib.providers.gofeatureflag.GoFeatureFlagProviderOptions; import dev.openfeature.contrib.providers.gofeatureflag.exception.InvalidOptions; +import dev.openfeature.contrib.providers.ofrep.OfrepProvider; import dev.openfeature.sdk.Client; import dev.openfeature.sdk.FeatureProvider; import dev.openfeature.sdk.OpenFeatureAPI; @@ -54,6 +54,9 @@ private synchronized void initializeFeatureProvider(OpenFeatureConfiguration con new RuntimeException(e); } break; + case OFREP: + featureProvider = OfrepProvider.constructProvider(config.getOfrep().getOfrepProviderOptions()); + break; } } } diff --git a/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/OpenFeatureConfiguration.java b/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/OpenFeatureConfiguration.java index 6a4d48d..b4e463f 100644 --- a/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/OpenFeatureConfiguration.java +++ b/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/OpenFeatureConfiguration.java @@ -15,6 +15,10 @@ public class OpenFeatureConfiguration { @JsonProperty private GoFeatureFlagConfiguration gofeatureflag = new GoFeatureFlagConfiguration(); + @Valid + @JsonProperty + private OfrepConfiguration ofrep = new OfrepConfiguration(); + @Valid @JsonProperty private OpenFeatureHealthCheckConfiguration healthcheck = new OpenFeatureHealthCheckConfiguration(); @@ -40,6 +44,14 @@ public void setGoFeatureFlag(GoFeatureFlagConfiguration gofeatureflag) { this.gofeatureflag = gofeatureflag; } + public OfrepConfiguration getOfrep() { + return ofrep; + } + + public void setOfrep(OfrepConfiguration ofrep) { + this.ofrep = ofrep; + } + public OpenFeatureHealthCheckConfiguration getHealthcheck() { return healthcheck; } diff --git a/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/ProviderType.java b/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/ProviderType.java index 7f846df..4edd5b0 100644 --- a/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/ProviderType.java +++ b/src/main/java/io/github/sideshowcoder/dropwizard_openfeature/ProviderType.java @@ -3,5 +3,6 @@ public enum ProviderType { FLAGD, GOFEATUREFLAG, + OFREP, INMEMORY; } diff --git a/src/test/java/io/github/sideshowcoder/dropwizard_openfeature/OpenFeatureBundleGoFeatureFlagProviderTest.java b/src/test/java/io/github/sideshowcoder/dropwizard_openfeature/OpenFeatureBundleGoFeatureFlagProviderTest.java index 8a5d281..6978430 100644 --- a/src/test/java/io/github/sideshowcoder/dropwizard_openfeature/OpenFeatureBundleGoFeatureFlagProviderTest.java +++ b/src/test/java/io/github/sideshowcoder/dropwizard_openfeature/OpenFeatureBundleGoFeatureFlagProviderTest.java @@ -3,16 +3,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import java.util.List; - import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.testcontainers.containers.GenericContainer; -import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; -import org.testcontainers.utility.DockerImageName; -import org.testcontainers.utility.MountableFile; import com.codahale.metrics.health.HealthCheck; @@ -25,24 +19,14 @@ import io.dropwizard.testing.junit5.DropwizardExtensionsSupport; import io.github.sideshowcoder.dropwizard_openfeature.helpers.App; import io.github.sideshowcoder.dropwizard_openfeature.helpers.Config; +import io.github.sideshowcoder.dropwizard_openfeature.helpers.GoFeatureFlagContainer; @Testcontainers @ExtendWith(DropwizardExtensionsSupport.class) public class OpenFeatureBundleGoFeatureFlagProviderTest { @Container - private static GenericContainer goFeatureFlagRelay = createGoFeatureFlagContainer(); - - private static GenericContainer createGoFeatureFlagContainer() { - GenericContainer container = new GenericContainer<>(DockerImageName.parse("gofeatureflag/go-feature-flag:latest")) - .withCopyFileToContainer(MountableFile.forClasspathResource("goff-proxy.yaml"), "/goff/goff-proxy.yaml") - .withCopyFileToContainer(MountableFile.forClasspathResource("go-feature-flags-flags.yaml"), "/goff/flags.yaml"); - - container.setPortBindings(List.of("1031:1031")); - container.waitingFor(Wait.forHttp("/health")); - - return container; - } + private static GoFeatureFlagContainer container = GoFeatureFlagContainer.create(); private static final DropwizardAppExtension APP = new DropwizardAppExtension<>( App.class, @@ -56,7 +40,7 @@ public void initializesHealthCheck() throws Exception { } @Test - public void providesFeatureFlagsViaInMemoryProvider() throws Exception { + public void providesFeatureFlagsGoFeatureFlag() throws Exception { Client client = OpenFeatureAPI.getInstance().getClient("go-feature-flag-client"); // GoFeatureFlags requires a target key for all queries! EvaluationContext ctx = new ImmutableContext("target"); diff --git a/src/test/java/io/github/sideshowcoder/dropwizard_openfeature/OpenFeatureBundleOfrepProviderTest.java b/src/test/java/io/github/sideshowcoder/dropwizard_openfeature/OpenFeatureBundleOfrepProviderTest.java new file mode 100644 index 0000000..869a4c6 --- /dev/null +++ b/src/test/java/io/github/sideshowcoder/dropwizard_openfeature/OpenFeatureBundleOfrepProviderTest.java @@ -0,0 +1,49 @@ +package io.github.sideshowcoder.dropwizard_openfeature; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.testcontainers.junit.jupiter.Container; +import org.testcontainers.junit.jupiter.Testcontainers; + +import com.codahale.metrics.health.HealthCheck; + +import dev.openfeature.sdk.Client; +import dev.openfeature.sdk.EvaluationContext; +import dev.openfeature.sdk.ImmutableContext; +import dev.openfeature.sdk.OpenFeatureAPI; +import io.dropwizard.testing.ResourceHelpers; +import io.dropwizard.testing.junit5.DropwizardAppExtension; +import io.dropwizard.testing.junit5.DropwizardExtensionsSupport; +import io.github.sideshowcoder.dropwizard_openfeature.helpers.App; +import io.github.sideshowcoder.dropwizard_openfeature.helpers.Config; +import io.github.sideshowcoder.dropwizard_openfeature.helpers.GoFeatureFlagContainer; + +@Testcontainers +@ExtendWith(DropwizardExtensionsSupport.class) +public class OpenFeatureBundleOfrepProviderTest { + + @Container + private static GoFeatureFlagContainer container = GoFeatureFlagContainer.create(); + + private static final DropwizardAppExtension APP = new DropwizardAppExtension<>( + App.class, + ResourceHelpers.resourceFilePath("ofrep-provider-config.yml") + ); + + @Test + public void initializesHealthCheck() throws Exception { + HealthCheck.Result healthcheckResult = APP.getEnvironment().healthChecks().runHealthCheck("openfeature-health-check"); + assertTrue(healthcheckResult.isHealthy()); + } + + @Test + public void providesFeatureFlagsOfrepProvider() throws Exception { + Client client = OpenFeatureAPI.getInstance().getClient("ofrep-client"); + // GoFeatureFlags requires a target key for all queries even using ofrep protocol! + EvaluationContext ctx = new ImmutableContext("target"); + assertEquals("red", client.getStringValue("staticstringflag", "not-expected-value", ctx)); + } +} diff --git a/src/test/java/io/github/sideshowcoder/dropwizard_openfeature/helpers/GoFeatureFlagContainer.java b/src/test/java/io/github/sideshowcoder/dropwizard_openfeature/helpers/GoFeatureFlagContainer.java new file mode 100644 index 0000000..0d150bc --- /dev/null +++ b/src/test/java/io/github/sideshowcoder/dropwizard_openfeature/helpers/GoFeatureFlagContainer.java @@ -0,0 +1,47 @@ +package io.github.sideshowcoder.dropwizard_openfeature.helpers; + +import java.util.List; + +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.wait.strategy.Wait; +import org.testcontainers.utility.DockerImageName; +import org.testcontainers.utility.MountableFile; + +public class GoFeatureFlagContainer extends GenericContainer { + + public static final DockerImageName GO_FEATURE_FLAG_DOCKER_IMAGE_NAME = DockerImageName.parse("gofeatureflag/go-feature-flag:latest"); + + private static final String CONTAINER_PROXY_CONFIG_PATH = "/goff/goff-proxy.yaml"; + private static final String CONTAINER_FLAGS_CONFIG_PATH = "/goff/flags.yaml"; + private static final String DEFAULT_PROXY_RESOURCE_PATH = "goff-proxy.yaml"; + private static final String DEFAULT_FLAGS_RESOURCE_PATH = "go-feature-flags-flags.yaml"; + + + public static GoFeatureFlagContainer create() { + return new GoFeatureFlagContainer(GO_FEATURE_FLAG_DOCKER_IMAGE_NAME) + .withProxyConfiguration(DEFAULT_PROXY_RESOURCE_PATH) + .withFlagsConfiguration(DEFAULT_FLAGS_RESOURCE_PATH); + } + + public GoFeatureFlagContainer(DockerImageName imageName) { + super(imageName); + imageName.assertCompatibleWith(GO_FEATURE_FLAG_DOCKER_IMAGE_NAME); + } + + public GoFeatureFlagContainer withProxyConfiguration(String resourceName) { + withCopyFileToContainer(MountableFile.forClasspathResource(resourceName), CONTAINER_PROXY_CONFIG_PATH); + return self(); + + } + + public GoFeatureFlagContainer withFlagsConfiguration(String resourceName) { + withCopyFileToContainer(MountableFile.forClasspathResource(resourceName), CONTAINER_FLAGS_CONFIG_PATH); + return self(); + } + + @Override + protected void configure() { + setPortBindings(List.of("1031:1031")); + waitingFor(Wait.forHttp("/health")); + } +} diff --git a/src/test/resources/ofrep-config.yml b/src/test/resources/ofrep-config.yml new file mode 100644 index 0000000..404a9d3 --- /dev/null +++ b/src/test/resources/ofrep-config.yml @@ -0,0 +1,5 @@ +openfeature: + provider: ofrep + ofrep: + baseUrl: "http://localhost:1031/" + timeout: 5 diff --git a/src/test/resources/ofrep-provider-config.yml b/src/test/resources/ofrep-provider-config.yml new file mode 100644 index 0000000..eef16fa --- /dev/null +++ b/src/test/resources/ofrep-provider-config.yml @@ -0,0 +1,6 @@ +openfeature: + provider: ofrep + ofrep: + baseurl: http://localhost:1031 + timeout: 500 + threadcount: 1 From 674182f30c04e18e9d69b91715589c07f11bde2f Mon Sep 17 00:00:00 2001 From: Philipp Fehre Date: Fri, 6 Mar 2026 11:17:29 +0100 Subject: [PATCH 2/2] docker compose and rest requests sample rest requests use https://github.com/pashky/restclient.el --- compose.yaml | 18 ++++++++++++++++ flag-provider-requests.restclient | 36 +++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 compose.yaml create mode 100644 flag-provider-requests.restclient diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..c735e8e --- /dev/null +++ b/compose.yaml @@ -0,0 +1,18 @@ +services: + go-feature-flag: + image: gofeatureflag/go-feature-flag:latest + ports: + - 1031:1031 # relay proxy port + volumes: + # relay proxy config + - ./src/test/resources/goff-proxy.yaml:/goff/goff-proxy.yaml + # flags to be served + - ./src/test/resources/go-feature-flags-flags.yaml:/goff/flags.yaml + flagd: + image: ghcr.io/open-feature/flagd:latest + command: start --uri file:/etc/flagd/flagd-test-flags.json + ports: + - 8013:8013 # standard port + - 8016:8016 # ofrep port + volumes: + - ./src/test/resources:/etc/flagd diff --git a/flag-provider-requests.restclient b/flag-provider-requests.restclient new file mode 100644 index 0000000..cd820ad --- /dev/null +++ b/flag-provider-requests.restclient @@ -0,0 +1,36 @@ +### flagd ### +POST http://localhost:8013/flagd.evaluation.v1.Service/ResolveString +Content-Type: application/json + +{ + "flagKey": "static-string-flag", + "context": {} +} + +### ofrep ### + +# flagd bulk +POST http://localhost:8016/ofrep/v1/evaluate/flags + +# flagd flag +POST http://localhost:8016/ofrep/v1/evaluate/flags/static-string-flag + +# go-feature-flag +POST http://localhost:1031/ofrep/v1/evaluate/flags/staticstringflag +Content-Type: application/json + +{ + "context": { + "targetingKey": "key" + } +} + +# go-feature-flag bulk +POST http://localhost:1031/ofrep/v1/evaluate/flags +Content-Type: application/json + +{ + "context": { + "targetingKey": "key" + } +}