featureflags

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: MPL-2.0 Imports: 1 Imported by: 1

Documentation

Overview

The featureflags module exists to control optional functionality

The main purpose is to hide functionality that is still in development, that isn't yet fully featured enough to be GA, or that isn't relevant to all users.

The format is key-value, both strings, for rare situations where new values need to be introduced to the same flag. You should usually treat the value as a boolean - create one flag per alternative, don't create complicated sets of values. E.g. set FOO_BAR_ENABLED and FOO_BAR_IN_MAIN_MENU as separate flags, not FOO_BAR="enabled" or "FOO_BAR="in_main_menu", as the latter format is more likely to be confused. At the same time, you should check for exact value when checking the flag, to avoid misinterpreting it in the future.

All flags that are set here on the backend will also be set in the featureflags endpoint on the frontend.

Index

Constants

View Source
const (
	FeatureFlagSet string = "true"
)

Variables

This section is empty.

Functions

func Get

func Get(key string) string

Get returns the value of a flag, or "" if the flag wasn't set You should use the same behaviour for "flag not set" as you would for "flag set to unknown value", so always check for the exact value.

func GetFlags

func GetFlags() map[string]string

GetFlags returns all featureflags This is only intended to be used by the API to return the flags to the frontend - for all other uses, use `Get`

func IsSet added in v0.31.0

func IsSet(key string) bool

IsSet returns true if the named feature flag is set.

func Set

func Set(key, value string)

Set sets one specific featureflag Existing flags will be overwritten.

func SetBoolean added in v0.31.0

func SetBoolean(key string, b bool)

SetBoolean sets the named feature flag to the boolean flag state. If set to true, IsSet will return true for the same name.

func SetFromEnv added in v0.9.4

func SetFromEnv(envVars []string)

SetFromEnv sets the feature flags from the environment variables

Types

This section is empty.

Jump to

Keyboard shortcuts

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