• Home
  • Integrations
  • SDKs
  • Guides
  • API docs
No results for ""
EXPAND ALL

EDIT ON GITHUB

Turning flags on and off

Read time: 2 minutes
Last edited: Jun 29, 2021

Overview

This topic explains how to enable and disable flags in the LaunchDarkly platform.

One-click control of flag behavior is critical to nimble feature management. With LaunchDarkly, you can turn a flag on or off right from the dashboard.

The flag toggle button is a kill switch for any feature

The flag button lets you turn off a feature that's misbehaving without needing to touch any code or re-deploy your application. Wrap the entire feature in a feature flag to control or revoke its rollout seamlessly.

Here is a screenshot of the dashbaord:

The dashboard with two flag toggles called out.
The dashboard with two flag toggles called out.

Use the toggle in a flag's Targeting tab

You can also turn a flag on or off from the flag's Targeting tab. To learn more about flag targeting, read Targeting users.

Flag behavior can do a lot more than just turning features on or off. Continue reading to learn more.

Turning flags on

When you create a new flag, it is turned off by default. You can turn the flag on by clicking the flag toggle button in the dashboard or the flag's Targeting tab.

To turn a flag on:

  1. Navigate to the dashboard or the Targeting tab in the flag detail page.
  2. Click the flag toggle. The toggle turns green and displays the word on:

The flag toggle in the Targeting tab.
The flag toggle in the Targeting tab.

To learn more about creating flags, read Creating a feature flag.

Turning flags off

When you turn a flag to off, you disable the targeting rules for that flag. Instead of serving an active variation, you serve the off variation.

In the Targeting tab, you can set an off variation for both boolean and multivariate flags. Boolean feature flags default to false when the feature flag is off.

To turn a flag off:

  1. Navigate to the dashboard or the Targeting tab in the flag detail page.
  2. Set the toggle to off:

The Targeting tab with the flag turned off.
The Targeting tab with the flag turned off.

If you don't specify an explicit off variation, LaunchDarkly serves the fallback value for the flag. You can specify the fallback value in your code's variation calls. This is also the value that LaunchDarkly serves if your application is unable to connect to LaunchDarkly's servers.

This value is indicated at the bottom of the Targeting tab:

The fallback value at the bottom of the Targeting tab.
The fallback value at the bottom of the Targeting tab.

Planning feature flags for future events

You can schedule a flag for a particular date using scheduled flag changes, or you can use targeting rules to control what it affects and when. For example, you can serve false to deprecate a feature after a date of your choosing, or you can target a specific user or segment to be removed from the flag's targeting settings. To learn more, read Targeting users.