This is the CloudBees provider implementation for OpenFeature for the Go SDK.
OpenFeature provides a vendor-agnostic abstraction layer on Feature Flag management.
This provider allows the use of CloudBees Feature Management as a backend for Feature Flag configurations.
- go 18 or above
go get github.com/rollout/cloudbees-openfeature-provider-go
Follow the instructions on the Go SDK project for how to use the Go SDK.
You can configure the CloudBees provider by doing the following:
package main
import (
"context"
"fmt"
"github.com/open-feature/go-sdk/pkg/openfeature"
"github.com/rollout/cloudbees-openfeature-provider-go/pkg/cloudbees"
)
func main() {
appKey := "INSERT_APP_KEY_HERE"
if provider, err := cloudbees.NewProvider(appKey); err == nil {
openfeature.SetProvider(provider)
client := openfeature.NewClient("app")
value, err := client.BooleanValue(context.Background(), "enableTutorial", false, openfeature.EvaluationContext{})
fmt.Printf("flag value: %v, error: %v", value, err)
} else {
fmt.Printf("error creating client %v", err)
}
}