Skip to content

Environment Overrides

All backend SDKs support overriding flag values using environment variables. This is useful for local development, testing, and CI environments where you want to control flags without changing them in the dashboard.

Set an environment variable with the FLAGS_ prefix followed by the flag name in uppercase:

Terminal window
export FLAGS_MY_FEATURE=true
export FLAGS_BETA_MODE=false

When you check a flag, the SDK checks environment variables before checking the API or cache. If a matching environment variable exists, its value is used immediately.

Flag names are normalized to match environment variable names. All of these refer to the same flag:

Environment VariableMatches Flag Names
FLAGS_MY_FEATUREmy-feature, my_feature, my feature
FLAGS_DARK_MODEdark-mode, dark_mode, dark mode

The normalization converts hyphens, underscores, and spaces to a common form and ignores case.

true, 1, on, yes, enabled

false, 0, off, no, disabled

Flags are resolved in this order (highest priority first):

  1. Environment variable (FLAGS_*)
  2. Cached value (from API response)
  3. Default (false / disabled)
Terminal window
# Enable a feature only on your machine
FLAGS_NEW_CHECKOUT=true go run ./cmd/server
Terminal window
# Disable analytics in test environment
FLAGS_ANALYTICS=false pytest tests/
ENV FLAGS_MAINTENANCE_MODE=false
docker-compose.yml
services:
app:
environment:
- FLAGS_BETA_FEATURE=true