MCPcopy
hub / github.com/docker/compose / IsFeatureActive

Function IsFeatureActive

internal/desktop/client.go:182–196  ·  view source on GitHub ↗

IsFeatureActive reports whether Docker Desktop is the active engine and the given feature flag is enabled. Returns false silently on any failure — the engine being unreachable, Desktop not being the active engine, or the flag being off — so callers can use this as a single gating check.

(ctx context.Context, apiClient client.APIClient, feature string)

Source from the content-addressed store, hash-verified

180// engine being unreachable, Desktop not being the active engine, or the flag
181// being off — so callers can use this as a single gating check.
182func IsFeatureActive(ctx context.Context, apiClient client.APIClient, feature string) bool {
183 endpoint, err := Endpoint(ctx, apiClient)
184 if err != nil || endpoint == "" {
185 return false
186 }
187
188 c := NewClient(endpoint)
189 defer c.Close() //nolint:errcheck
190
191 enabled, err := c.IsFeatureEnabled(ctx, feature)
192 if err != nil {
193 return false
194 }
195 return enabled
196}
197
198// IsFeatureActiveStandalone is the convenience form of IsFeatureActive for
199// callers without an existing engine API client (e.g. the compose plugin hook

Callers 2

Calls 4

CloseMethod · 0.95
IsFeatureEnabledMethod · 0.95
EndpointFunction · 0.85
NewClientFunction · 0.85

Tested by

no test coverage detected