5 Feature Flagging
James Mills edited this page 6 months ago

Feature Flagging

Backend Setup

  1. Edit internal/features.go
  2. Add a new FeatureXXX constant
  3. Add new case(s0 for handling the new feature (See FeatureFoo for copy/paste example)

Backend Usage

Once a new feature has been defined in teh Backend (see above) you can test for the feature with the a call to s.config.Features.IsEnabeld(). Example:

if s.config.Features.IsEnabled(FeatureInternalEvents) {
  // Code here
}

Frontend Usage

Once a new feature has been defined in teh Backend (see above) you can test for the feature with the isFeatureEnabled <name> template function. Example:

{{ if isFeatureEnabled "magic_link_auth" }}
  <p><a href="/login/email">{{ tr . "LoginViaEmailAddress" }}</a></p>
{{ end }}