From d9bf269c6001ddc388090c69a31ae09fb1ca74c3 Mon Sep 17 00:00:00 2001 From: Roberto Dip Date: Tue, 22 Nov 2022 14:26:36 -0300 Subject: [PATCH] add dev flag to aid UI development (#8789) --- server/service/appconfig.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/server/service/appconfig.go b/server/service/appconfig.go index e7b75103e3..7484990603 100644 --- a/server/service/appconfig.go +++ b/server/service/appconfig.go @@ -13,6 +13,7 @@ import ( "net" "net/http" "net/url" + "os" "github.com/fleetdm/fleet/v4/server/authz" authz_ctx "github.com/fleetdm/fleet/v4/server/contexts/authz" @@ -43,6 +44,14 @@ type appConfigResponseFields struct { Logging *fleet.Logging `json:"logging,omitempty"` // SandboxEnabled is true if fleet serve was ran with server.sandbox_enabled=true SandboxEnabled bool `json:"sandbox_enabled,omitempty"` + // MDMEnabled is true if fleet serve was ran with FLEET_DEV_MDM_ENABLED=1 + // + // This is used only for UI development, for more details check + // https://github.com/fleetdm/fleet/issues/8751 + // + // TODO: remove this flag once the MDM feature is ready for + // release. + MDMEnabled bool `json:"mdm_enabled,omitempty"` Err error `json:"error,omitempty"` } @@ -135,6 +144,12 @@ func getAppConfigEndpoint(ctx context.Context, request interface{}, svc fleet.Se License: license, Logging: loggingConfig, SandboxEnabled: svc.SandboxEnabled(), + // Undocumented feature flag for MDM, used only for UI development, for + // more details check https://github.com/fleetdm/fleet/issues/8751 + // + // TODO: remove this flag once the MDM feature is ready for + // release. + MDMEnabled: os.Getenv("FLEET_DEV_MDM_ENABLED") == "1", }, } return response, nil