fflags

package
v0.0.0-...-4f10b81 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FFlags

type FFlags struct {
	Flags map[string]func() bool
	// contains filtered or unexported fields
}

This implementation a hack to be replaced later with a proper feature flags backend. We will also need to pass in additional api user info into this API so that the answer can differ depending on who is asking. This is needed to allow admin-only access, or only partial rollouts of features, for example.

func NewFFlags

func NewFFlags(logger *zap.SugaredLogger) *FFlags

func (*FFlags) GetFlag

func (f *FFlags) GetFlag(c *gin.Context, flag string) (bool, error)

GetFlag returns whether the feature named by the string parameter flag is enabled (true) or not (false). An error is returned if the flag name is invalid.

func (*FFlags) ListFlags

func (f *FFlags) ListFlags(c *gin.Context) map[string]bool

ListFlags returns a map of all currently defined feature flags and whether those features are enabled (true) or not (false).

func (*FFlags) RegisterEnvFlag

func (f *FFlags) RegisterEnvFlag(name, env string, defaultValue bool)

func (*FFlags) RegisterFlag

func (f *FFlags) RegisterFlag(name string, fn func() bool)

Jump to

Keyboard shortcuts

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