Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterAllFeatures() error
- type Feature
- type FeatureRegister
- func (fr *FeatureRegister) GetAllFeatures() []Feature
- func (fr *FeatureRegister) GetEnabledFeatures() []string
- func (fr *FeatureRegister) GetFeature(featureName string) (*Feature, error)
- func (fr *FeatureRegister) RegisterFeature(feat *Feature) error
- func (fr *FeatureRegister) SetFromEnv(logger *logrus.Logger) error
- func (fr *FeatureRegister) SetFromYaml(r io.Reader, logger *logrus.Logger) error
- func (fr *FeatureRegister) SetFromYamlFile(path string, logger *logrus.Logger) error
Constants ¶
View Source
const ( ActiveState = iota // the feature can be enabled, and its description is logged (Info) DeprecatedState // the feature can be enabled, and a deprecation message is logged (Warning) RetiredState // the feature is ignored and a deprecation message is logged (Error) )
Variables ¶
View Source
var ( ErrFeatureNameEmpty = errors.New("name is empty") ErrFeatureNameCase = errors.New("name is not lowercase") ErrFeatureNameInvalid = errors.New("invalid name (allowed a-z, 0-9, _, .)") ErrFeatureUnknown = errors.New("unknown feature") ErrFeatureDeprecated = errors.New("the flag is deprecated") ErrFeatureRetired = errors.New("the flag is retired") )
View Source
var ChunkedDecisionsStream = &Feature{Name: "chunked_decisions_stream", Description: "Enable chunked decisions stream"}
View Source
var Crowdsec = FeatureRegister{EnvPrefix: "CROWDSEC_FEATURE_"}
View Source
var CscliSetup = &Feature{Name: "cscli_setup", Description: "Enable cscli setup command (service detection)"}
View Source
var DisableHttpRetryBackoff = &Feature{Name: "disable_http_retry_backoff", Description: "Disable http retry backoff"}
View Source
var PapiClient = &Feature{Name: "papi_client", Description: "Enable Polling API client"}
View Source
var Re2GrokSupport = &Feature{Name: "re2_grok_support", Description: "Enable RE2 support for GROK patterns"}
View Source
var Re2RegexpInfileSupport = &Feature{Name: "re2_regexp_in_file_support", Description: "Enable RE2 support for RegexpInFile expr helper"}
Functions ¶
func RegisterAllFeatures ¶
func RegisterAllFeatures() error
Types ¶
type Feature ¶
type Feature struct { Name string State int // active, deprecated, retired // Description should be a short sentence, explaining the feature. Description string // DeprecationMessage is used to inform the user of the behavior that has // been decided when the flag is/was finally retired. DeprecationMsg string // contains filtered or unexported fields }
type FeatureRegister ¶
type FeatureRegister struct { EnvPrefix string // contains filtered or unexported fields }
A register allows to enable features from the environment or a file
func (*FeatureRegister) GetAllFeatures ¶
func (fr *FeatureRegister) GetAllFeatures() []Feature
GetAllFeatures returns a slice of all the known features, ordered by name
func (*FeatureRegister) GetEnabledFeatures ¶
func (fr *FeatureRegister) GetEnabledFeatures() []string
GetEnabledFeatures returns the list of features that have been enabled by the user
func (*FeatureRegister) GetFeature ¶
func (fr *FeatureRegister) GetFeature(featureName string) (*Feature, error)
func (*FeatureRegister) RegisterFeature ¶
func (fr *FeatureRegister) RegisterFeature(feat *Feature) error
func (*FeatureRegister) SetFromEnv ¶
func (fr *FeatureRegister) SetFromEnv(logger *logrus.Logger) error
func (*FeatureRegister) SetFromYaml ¶
func (*FeatureRegister) SetFromYamlFile ¶
func (fr *FeatureRegister) SetFromYamlFile(path string, logger *logrus.Logger) error
Click to show internal directories.
Click to hide internal directories.