DEVOPS / A CONCEPT NOTE

Feature Flags

turning features on and off without deploying code

~75 sec read

Overview · mechanism
pitfall · examples

01 / THE SHORT VERSION

The idea in a few sentences.

Feature flags (aka feature toggles) are conditionals in your code that enable or disable functionality without a deployment. You wrap a new feature in if (flags.isEnabled('new-checkout')) { ... }. The flag service evaluates at runtime — flip a switch and the feature activates for all users, a beta group, or just internal testers.

02 / FOLLOW THE MECHANISM

How a feature flag evaluates

  1. Developer

    merges code with a flag check: if (flagService.isEnabled('dark-mode')) — the new code is deployed but dormant.

  2. Flag service

    LaunchDarkly, Split, or a custom API — holds the flag targeting rules in real-time.

  3. Runtime

    when isEnabled is called, the SDK fetches the flag rules (cached locally) and evaluates against user attributes.

  4. Operator

    flips the flag to 100% on — the feature activates instantly for all users. No deploy, no restart.

04 / COMMAND NOTES

Read the command, then the result.

Inspect the flags and arguments before trying an example. Snippets can need local setup, replacement values, or resources in your own environment.

EXAMPLE 01 · REFERENCE

evaluate a feature flag via API

curl -s https://launchdarkly.com/sdk/flag/eval/my-flag --header "Authorization: $SDK_KEY"

EXAMPLE 02 · REFERENCE

count flag usage in codebase

git grep "featureFlag|isEnabled" -- '*.ts' '*.go' '*.py' | wc -l

Explore command anatomy in the CLI lab