Skip to content

Latest commit

 

History

History
26 lines (15 loc) · 1.55 KB

File metadata and controls

26 lines (15 loc) · 1.55 KB

Feature flags

Feature flags can be used to programatically turn features on and off. We can use them to control the release of features in different environments or at different times.

List of current flags

  • TestFlag (Default: false): Flag added to test the functionality of feature flags. Adds a line to the layout that shows flags are working when set to true.
  • EditContactsUI (Default: false): Flag added to control who can see the edit contacts UI on the Trust contacts page while that is still in development.

Implementation

We have followed what is more or less the default DotNet appoach for adding feature flags to our application. More documentation on using feature flags can be found on the Microsoft docs here.

Adding a flag

To create a flag you need to add it as a constant to DfE.FindInformationAcadmiesTrusts/Configuration/FeatureFlags.cs and add a default value to the appsettings.json file. Finally add the flag name, default value (used in appsettings.json) and reason for creating the flag/what the flag controls to the list at the end of this file.

Using a flag

Flags can be used in 3 main ways to restrict parts of the code:

  • Using the tag helper in a razor page
  • Using an attribute on a class or function
  • Using dependency injection with the IFeatureManagement class

They can then be toggled using enviroment variables in each of the different environments, or using the appsettings.json file to override them when developing locally.