MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / ShowEnabled

Function ShowEnabled

internal/feature/features.go:137–155  ·  view source on GitHub ↗

ShowEnabled returns all the features enabled in the Gate contained in ctx.

(ctx context.Context)

Source from the content-addressed store, hash-verified

135
136// ShowEnabled returns all the features enabled in the Gate contained in ctx.
137func ShowEnabled(ctx context.Context) string {
138 featuresEnabled := []string{}
139 if gate, ok := ctx.Value(contextKey{}).(interface {
140 Gate
141 GetAll() map[Feature]featuregate.FeatureSpec
142 }); ok {
143 specs := gate.GetAll()
144 for feature := range specs {
145 // `gate.Enabled` first checks if the feature is enabled;
146 // then (if not explicitly set by the user),
147 // it checks if the feature is on/true by default
148 if gate.Enabled(feature) {
149 featuresEnabled = append(featuresEnabled, fmt.Sprintf("%s=true", feature))
150 }
151 }
152 }
153 slices.Sort(featuresEnabled)
154 return strings.Join(featuresEnabled, ",")
155}
156
157// ShowAssigned returns the features enabled or disabled by Set and SetFromMap
158// in the Gate contained in ctx.

Callers 2

mainFunction · 0.92
TestContextFunction · 0.85

Calls 2

ValueMethod · 0.80
EnabledMethod · 0.65

Tested by 1

TestContextFunction · 0.68