cloudbees-openfeature-provider-go

module
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2025 License: Apache-2.0

README

CloudBees Feature Management provider for OpenFeature

a OpenFeature Specification OpenFeature SDK CloudBees Rox SDK

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.

Requirements

  • go 18 or above

Installation

Add it to your build
go get github.com/rollout/cloudbees-openfeature-provider-go
Configuration

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)
	}
}

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL