Environment Overrides
Overview
Section titled “Overview”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.
How It Works
Section titled “How It Works”Set an environment variable with the FLAGS_ prefix followed by the flag name in uppercase:
export FLAGS_MY_FEATURE=trueexport FLAGS_BETA_MODE=falseWhen 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.
Name Normalization
Section titled “Name Normalization”Flag names are normalized to match environment variable names. All of these refer to the same flag:
| Environment Variable | Matches Flag Names |
|---|---|
FLAGS_MY_FEATURE | my-feature, my_feature, my feature |
FLAGS_DARK_MODE | dark-mode, dark_mode, dark mode |
The normalization converts hyphens, underscores, and spaces to a common form and ignores case.
Accepted Values
Section titled “Accepted Values”Truthy values
Section titled “Truthy values”true, 1, on, yes, enabled
Falsy values
Section titled “Falsy values”false, 0, off, no, disabled
Priority Order
Section titled “Priority Order”Flags are resolved in this order (highest priority first):
- Environment variable (
FLAGS_*) - Cached value (from API response)
- Default (
false/ disabled)
Examples
Section titled “Examples”Local development
Section titled “Local development”# Enable a feature only on your machineFLAGS_NEW_CHECKOUT=true go run ./cmd/server# Disable analytics in test environmentFLAGS_ANALYTICS=false pytest tests/Docker
Section titled “Docker”ENV FLAGS_MAINTENANCE_MODE=falseservices: app: environment: - FLAGS_BETA_FEATURE=true