featureflag

package
v0.0.0-...-ab145b9 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: MIT Imports: 4 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Environment string `envconfig:"ENVIRONMENT"`

	UnleashURL        string `envconfig:"UNLEASH_URL"`
	UnleashInstanceID string `envconfig:"UNLEASH_INSTANCE_ID"`
}

Config represents a Feature Flagger Configuration

type FeatureFlagger

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

FeatureFlagger represents a service to check feature flags

func New

func New(config *Config) (*FeatureFlagger, error)

New creates a new FeatureFlagger

func (*FeatureFlagger) IsEnabled

func (ff *FeatureFlagger) IsEnabled(key string, fallback bool) bool

IsEnabled checks if a feature flag is enabled globally

func (*FeatureFlagger) IsEnabledFor

func (ff *FeatureFlagger) IsEnabledFor(key string, fallback bool, userID string) bool

IsEnabled checks if a feature flag is enabled for a specific UserID

type UnleashListener

type UnleashListener struct{}

UnleashListener is our listener for Unleash events

func (UnleashListener) OnCount

func (l UnleashListener) OnCount(name string, enabled bool)

OnCount prints to the console when the feature is queried.

func (UnleashListener) OnError

func (l UnleashListener) OnError(err error)

OnError logs errors

func (UnleashListener) OnReady

func (l UnleashListener) OnReady()

OnReady prints to the console when the repository is ready.

func (UnleashListener) OnRegistered

func (l UnleashListener) OnRegistered(payload unleash.ClientData)

OnRegistered prints to the console when the client has registered.

func (UnleashListener) OnSent

func (l UnleashListener) OnSent(payload unleash.MetricsData)

OnSent prints to the console when the server has uploaded metrics.

func (UnleashListener) OnWarning

func (l UnleashListener) OnWarning(warning error)

OnWarning logs warnings

Jump to

Keyboard shortcuts

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