Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Latest commit

 

History

History
72 lines (44 loc) · 3.54 KB

flag-prerequisites.mdx

File metadata and controls

72 lines (44 loc) · 3.54 KB
path title description published tags
/home/flags/prerequisites
Flag prerequisites
This topic explains how to use feature flag prerequisites to enable or disable features based on different states.
true
prerequisite
flag
dependent
enterprise
Flag prerequisites is an Enterprise feature

Flag prerequisites is available to customers on an Enterprise plan. To learn more, read about our pricing. To upgrade your plan, contact Sales.

Overview

This topic explains how to use feature flag prerequisites to enable or disable features based on different states.

Prerequisites allow you to control feature dependencies in LaunchDarkly. You can make flags depend on other flags being enabled to take effect.

Using prerequisite and dependent flags

To meet a prerequisite, the prerequisite flag must be On, and the target must be receiving the variation of the prerequisite flag you specify.

You can manage prerequisites in the feature flag's Targeting tab:

A dependent flag's "Targeting" tab with the "prerequisites" section called out.

In the example above, for a target to receive the "true" variation of the dependent flag, the prerequisite flag must be On, and the target must be receiving the "Blue" variation of the prerequisite flag.

Prerequisite flags must be on

To meet a prerequisite, the prerequisite flag must be On. LaunchDarkly considers the prerequisite unmet if the prerequisite flag is Off, no matter what variation of the prerequisite flag the target is receiving.

For example, if a prerequisite flag serves "false" when targeting is Off, even if the variation specified in the prerequisite section is "false," LaunchDarkly still considers the prerequisite unmet when the flag is Off.

Behavior when prerequisites are unmet

If the prerequisite flag is Off, or if the target isn't receiving the specified variation of the prerequisite flag, the target will receive the "If targeting is off, serve" variation of the dependent flag.

Using multiple prerequisite flags

Flags can be dependent on multiple prerequisite flags. If a dependent flag has multiple prerequisite flags, then all of the prerequisite flag requirements must be met for LaunchDarkly to evaluate the dependent flag for a user.

A prerequisite flag displays any dependent flags on its Targeting tab:

The dependent flag section of a flag's "Targeting" tab.

You can also use the REST API: List dependent feature flags, List dependent feature flags by environment

LaunchDarkly automatically prevents you from saving changes that would introduce circular dependencies between prerequisites. For example, you cannot make Flag A a prerequisite of Flag B and also make Flag B a prerequisite of Flag A.

Deleting flags with dependents

You cannot delete a flag that is a prerequisite for other flags. You must remove the dependency before you can delete the prerequisite flag.