Flags and variations
A flag is something your code asks about: new-checkout, banner-color. It has a key,
which your code uses and which can’t change, a name, a description, tags, and a type, which
can’t change either.
| Type | Variations |
|---|---|
boolean |
Exactly two, false and true, fixed |
string |
2 to 20 strings |
number |
2 to 20 numbers |
object |
2 to 20 JSON objects |
A flag’s variations are the values it can serve. Each has a key (blue), an optional name
(Blue) and a value of the flag’s type, at most 32 KB of JSON. A variation an environment serves
can’t be removed until its targeting there stops serving it.
Keys of flags, environments, segments and variations are lowercase letters, digits, _ and -,
start with a letter or digit, and are at most 64 characters. A flag’s key is unique in its
project; a deleted flag’s key can be used again.
Environments
An environment (production, staging) belongs to a project. Each flag has its own
targeting in each environment, and each environment has its own SDK keys,
so an app reads exactly one environment’s flags. An environment can require a comment on
every targeting change.
Targeting configs and versions
A flag’s targeting in one environment is its config: whether it’s on, what it serves when
it’s off, its individual targets, its rules and its default rule
(Targeting). A new flag’s config is off in every environment, serving its first
variation. A boolean flag is off serving false, and its default rule serves true, so turning
it on serves true; a new environment gets an off config for every flag.
Every change to a config is a new version, kept for the flag’s life with who made it, when,
and the comment. Restoring an old version writes its content as a new version. A change is
refused if the config changed since it was read (412), so two people never overwrite each
other.
Client-side flags
A flag marked client-side can be evaluated with a client key, in web pages. A client key never sees other flags, and can’t tell them from flags that don’t exist.
Archiving
Archiving a flag takes it out of every environment, so SDKs answer the default value your code gives. Its targeting and history stay, and unarchiving serves it again. Only an archived flag can be deleted.