Documentation ¶
Overview ¶
Package featureflag implements simple feature-flagging. Feature flags can become an anti-pattern if abused. We should try to use them for two use-cases:
- `Preview` feature flags enable a piece of functionality we haven't yet fully baked. The user needs to 'opt-in'. We expect these flags to be removed at some time. Normally these will default to false.
- Escape-hatch feature flags turn off a default that we consider risky (e.g. pre-creating DNS records). This lets us ship a behaviour, and if we encounter unusual circumstances in the field, we can allow the user to turn the behaviour off. Normally these will default to true.
Feature flags are set via a single environment variable. The value is a string of feature flag keys separated by sequences of whitespace and comma. Each key can be prefixed with `+` (enable flag) or `-` (disable flag). Without prefix the flag gets enabled.
Index ¶
Constants ¶
View Source
const (
// Name is the name of the environment variable which encapsulates feature flags.
Name = "STEWARD_FEATURE_FLAGS"
)
Variables ¶
View Source
var ( // Dummy shows how to define a feature flag. DO NOT USE IT! Dummy = New("Dummy", Bool(false)) // CreateAuxNamespaceIfUnused controls whether auxiliary namespaces for // pipeline runs are created although they are not used. CreateAuxNamespaceIfUnused = New("CreateAuxNamespaceIfUnused", Bool(false)) // RetryOnInvalidPipelineRunsConfig controls whether the execution of a pipeline run // is failed or retried on pipeline run configuration errors. RetryOnInvalidPipelineRunsConfig = New("RetryOnInvalidPipelineRunsConfig", Bool(false)) )
Functions ¶
func ParseFlags ¶
func ParseFlags(f string)
ParseFlags is responsible for parse out the feature flag usage.
Types ¶
type FeatureFlag ¶
type FeatureFlag struct { Key string // contains filtered or unexported fields }
FeatureFlag defines a feature flag
func (*FeatureFlag) Enabled ¶
func (f *FeatureFlag) Enabled() bool
Enabled checks if the flag is enabled.
Click to show internal directories.
Click to hide internal directories.