Documentation
¶
Index ¶
- func Enabled(key, userID string, attrs ...Attr) bool
- func Init(conf Config, log logrus.FieldLogger) error
- func Int(key string, defaultVal int, userID string, attrs ...Attr) int
- func SetGlobalClient(client Client)
- func Variation(key, defaultVal, userID string, attrs ...Attr) string
- type Attr
- type Client
- type Config
- type MockClient
- func (c MockClient) AllEnabledFlags(key string) []string
- func (c MockClient) AllEnabledFlagsUser(key string, _ lduser.User) []string
- func (c MockClient) Enabled(key, userID string, _ ...Attr) bool
- func (c MockClient) EnabledUser(key string, _ lduser.User) bool
- func (c MockClient) Int(key string, defaultVal int, userID string, _ ...Attr) int
- func (c MockClient) IntUser(key string, defaultVal int, _ lduser.User) int
- func (c MockClient) Variation(key string, defaultVal string, userID string, _ ...Attr) string
- func (c MockClient) VariationUser(key string, defaultVal string, _ lduser.User) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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)
Types ¶
type Attr ¶ added in v0.58.1
func StringAttr ¶ added in v0.58.1
type Client ¶
type Client interface { Enabled(key, userID string, attrs ...Attr) bool EnabledUser(key string, user lduser.User) bool Variation(key, defaultVal, userID string, attrs ...Attr) string VariationUser(key string, defaultVal string, user lduser.User) string Int(key string, defaultVal int, userID string, attrs ...Attr) int IntUser(key string, defaultVal int, user lduser.User) int AllEnabledFlags(key string) []string AllEnabledFlagsUser(key string, user lduser.User) []string }
func GetGlobalClient ¶ added in v0.40.1
func GetGlobalClient() Client
type Config ¶
type Config struct { Key string `json:"key" yaml:"key"` RequestTimeout util.Duration `json:"request_timeout" yaml:"request_timeout" mapstructure:"request_timeout" split_words:"true" default:"5s"` Enabled bool `json:"enabled" yaml:"enabled" default:"false"` // Drop telemetry events (not needed in local-dev/CI environments) DisableEvents bool `json:"disable_events" yaml:"disable_events" mapstructure:"disable_events" split_words:"true"` // Set when using the Launch Darkly Relay proxy RelayHost string `json:"relay_host" yaml:"relay_host" mapstructure:"relay_host" split_words:"true"` // DefaultUserAttrs are custom LaunchDarkly user attributes that are added to every // feature flag check DefaultUserAttrs map[string]string `json:"default_user_attrs" yaml:"default_user_attrs"` // contains filtered or unexported fields }
type MockClient ¶
type MockClient struct { BoolVars map[string]bool StringVars map[string]string IntVars map[string]int }
func (MockClient) AllEnabledFlags ¶ added in v0.45.0
func (c MockClient) AllEnabledFlags(key string) []string
func (MockClient) AllEnabledFlagsUser ¶ added in v0.53.1
func (c MockClient) AllEnabledFlagsUser(key string, _ lduser.User) []string
func (MockClient) EnabledUser ¶ added in v0.42.0
func (c MockClient) EnabledUser(key string, _ lduser.User) bool
func (MockClient) VariationUser ¶ added in v0.42.0
Click to show internal directories.
Click to hide internal directories.