MCPcopy
hub / github.com/crowdsecurity/crowdsec / Set

Method Set

pkg/fflag/features.go:77–92  ·  view source on GitHub ↗

Set enables or disables a feature flag It should not be called directly by the user, but by SetFromEnv or SetFromYaml

(value bool)

Source from the content-addressed store, hash-verified

75// Set enables or disables a feature flag
76// It should not be called directly by the user, but by SetFromEnv or SetFromYaml
77func (f *Feature) Set(value bool) error {
78 // retired feature flags are ignored
79 if f.State == RetiredState {
80 return ErrFeatureRetired
81 }
82
83 f.enabled = value
84
85 // deprecated feature flags are still accepted, but a warning is triggered.
86 // We return an error but set the feature anyway.
87 if f.State == DeprecatedState {
88 return ErrFeatureDeprecated
89 }
90
91 return nil
92}
93
94// A register allows to enable features from the environment or a file
95type FeatureRegister struct {

Callers 15

doQueryMethod · 0.45
SetUpdatedAtMethod · 0.45
SetLastPushMethod · 0.45
SetLastHeartbeatMethod · 0.45
SetPasswordMethod · 0.45
SetIpAddressMethod · 0.45
SetScenariosMethod · 0.45
SetVersionMethod · 0.45
SetIsValidatedMethod · 0.45
SetAuthTypeMethod · 0.45
SetOsnameMethod · 0.45
SetOsfamilyMethod · 0.45

Calls

no outgoing calls

Tested by 3

TestIsEnabledFunction · 0.36
TestFeatureSetFunction · 0.36
TestGetEnabledFeaturesFunction · 0.36