featureflag

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enabled added in v0.40.1

func Enabled(key, userID string) bool

func Init added in v0.40.1

func Init(conf Config, log logrus.FieldLogger) error

Init will initialize global client with a launch darkly client

func SetGlobalClient added in v0.40.1

func SetGlobalClient(client Client)

func Variation added in v0.40.1

func Variation(key, defaultVal, userID string) string

Types

type Client

type Client interface {
	Enabled(key, userID string) bool
	Variation(key, defaultVal, userID string) string
}

func GetGlobalClient added in v0.40.1

func GetGlobalClient() Client

func NewClient

func NewClient(cfg *Config, logger logrus.FieldLogger) (Client, error)

type Config

type Config struct {
	Key            string
	RequestTimeout time.Duration `mapstructure:"request_timeout" split_words:"true" default:"5s"`
	Enabled        bool          `default:"false"`
}

type MockClient

type MockClient struct {
	BoolVars   map[string]bool
	StringVars map[string]string
}

func (MockClient) Enabled

func (c MockClient) Enabled(key, _ string) bool

func (MockClient) Variation

func (c MockClient) Variation(key, defaultVal, _ string) string

Jump to

Keyboard shortcuts

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