add dev flag to aid UI development (#8789)

This commit is contained in:
Roberto Dip 2022-11-22 14:26:36 -03:00 committed by GitHub
parent 5ef1bbeae9
commit d9bf269c60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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