Documentation
¶
Index ¶
Constants ¶
const ( LekkoURL = "https://prod.api.lekko.dev" LekkoAPIKeyHeader = "apikey" )
Variables ¶
This section is empty.
Functions ¶
func Merge ¶
Merge allows you to pass arbitrary context variables in order to perform rules evaluation on your feature flags in real time. Priority is given to newly added keys in lekkoCtx. TODO: allow users to run in safe mode, which will throw errors on ctx conflicts. TODO: this is not thread-safe, make it thread-safe.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
type ClientOptions ¶
type ClientOptions struct {
// Lekko namespace to read configurations from
Namespace string
// Arbitrary keys and values for rules evaluation that are
// injected into the context at startup. Context keys passed
// at runtime will override these values in case of conflict.
StartupContext map[string]interface{}
}
func (ClientOptions) NewClient ¶
func (o ClientOptions) NewClient(provider Provider) *Client
type Provider ¶
type Provider interface {
GetBoolFeature(ctx context.Context, key string, namespace string) (bool, error)
GetStringFeature(ctx context.Context, key string, namespace string) (string, error)
GetProtoFeature(ctx context.Context, key string, namespace string, result proto.Message) error
GetJSONFeature(ctx context.Context, key string, namespace string, result interface{}) error
}
A provider evaluates configuration from a number of sources.
func NewBackendProvider ¶
func NewBackendProvider(apiKey string, rk *RepositoryKey) Provider
Fetches configuration directly from Lekko Backend.
func NewSidecarProvider ¶
func NewSidecarProvider(ctx context.Context, url, apiKey string, rk *RepositoryKey) (Provider, error)
Fetches configuration from a lekko sidecar, likely running on the local network. Will make an RPC to register the client, so providing context is preferred.
func NewStaticProvider ¶
The static provider will read from a git repo via a relative path. This may be useful for local testing when a sidecar is not available.
type RepositoryKey ¶
type RepositoryKey struct {
// The name of the github owner. Can be a github
// organization name or a personal account name.
OwnerName string
// The name of the repository on github.
RepoName string
}
Identifies a configuration repository on github.com