-
Notifications
You must be signed in to change notification settings - Fork 261
Description
One of the powerful features of Flipt is separation by environment and/or namespace. Evaluation a flag across those dimensions is trivial using Flipt SDKs but is not really possible if you use OFREP.
The problem arises from the fact that environments and namespaces are not concepts in the openfeature specification. Flags in openfeature specification can just be evaluated with provided context, which is practically a map with key/values that can be matched against. This context can be leveraged to create the illusion of environments and namespaces.
In order to integrate OFREP evaluation on Flipt, I would argue it makes sense to define constants for environment and namespace context keys that are not Flipt-specific, in order to avoid implementation-detail specific properties to leak through the OFREP abstraction on the client side.
To be explicit, this is how I would envision such an integration from the client side:
import (
"github.com/open-feature/go-sdk-contrib/providers/ofrep"
"github.com/open-feature/go-sdk/openfeature"
)
provider := ofrep.NewProvider("https://my.flipt.server.com")
openfeature.SetNamedProvider("demo-app", provider)
client := openfeature.NewClient("demo-app")
output := client.String(context.TODO(), "<flag>", "<default>", openfeature.NewTargetlessEvaluationContext(map[string]any{
"environment": "<env>",
"namespace": "<namespace>",
}))
Flipt should be able to interpret environment
and namespace
evaluation context, and match it to Flipt environment and namespace to fetch the flag provided.
This will be a breaking change for people who are using these keys to match with existing rules, but in my opinion a better way of integrating OFREP with Flipt-specific concepts.
I am available for opening up a pull request if this gets support. :)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status