featureflags

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 4 Imported by: 5

Documentation

Overview

Package featureflags provides a shared client for evaluating feature flags against the flagd sidecar injected into a pod by the OpenFeature Operator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client evaluates feature flags. Every method fails open: if the flagd sidecar is unreachable or an evaluation errors, the caller-supplied default is returned rather than blocking or propagating the error - a briefly unavailable sidecar must degrade to "flag off," not "service won't start."

func New

func New(serviceName string) *Client

New creates a feature-flag client for serviceName, wired to the flagd sidecar injected into this pod by the OpenFeature Operator. The sidecar runs on localhost, so the provider uses its default RPC-mode configuration (host "localhost", port 8013) rather than a cluster-DNS address.

Provider setup is asynchronous (openfeature.SetProvider does not block) so a slow-starting or unreachable sidecar never delays service startup; evaluations made before the provider is ready simply fail open.

func (*Client) BoolFlag

func (c *Client) BoolFlag(ctx context.Context, key string, defaultValue bool) bool

BoolFlag evaluates a boolean flag, returning defaultValue if flagd is unreachable or the evaluation otherwise errors.

Jump to

Keyboard shortcuts

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