Skip to main content
Version: v0.17.3

Configure a flag

The goal of this module is to avoid having to host a backend to manage your feature flags and, to keep them centralized by using a single file as a source.

Your file must be a valid YAML, JSON or TOML file with a list of flags (examples: YAML, JSON, TOML).


A flag configuration looks like:


percentage: 100
rule: key eq "random-key"
true: true
false: false
default: false
disable: false
trackEvents: true
start: 2021-03-20T00:00:00.10-05:00
end: 2021-03-21T00:00:00.10-05:00

rule: key eq "not-a-key"
percentage: 100
true: true
false: false
default: false


"test-flag": {
"percentage": 100,
"rule": "key eq \"random-key\"",
"true": true,
"false": false,
"default": false,
"disable": false,
"trackEvents": true,
"rollout": {
"experimentation": {
"start": "2021-03-20T05:00:00.100Z",
"end": "2021-03-21T05:00:00.100Z"
"test-flag2": {
"rule": "key eq \"not-a-key\"",
"percentage": 100,
"true": true,
"false": false,
"default": false


percentage = 100.0
rule = "key eq \"random-key\""
true = true
false = false
default = false
disable = false
trackEvents = true


start = 2021-03-20T05:00:00.100Z
end = 2021-03-21T05:00:00.100Z

rule = "key eq \"not-a-key\""
percentage = 100.0
true = true
false = false
default = false

Format details

flag-keyThe flag-key is the name of your flag.
It must be unique.
On the example the flag keys are test-flag and test-flag2.
trueThe value return by the flag if apply to the user (rule is evaluated to true) and user is in the active percentage.
falseThe value return by the flag if apply to the user (rule is evaluated to true) and user is not in the active percentage.
defaultThe value return by the flag if not apply to the user (rule is evaluated to false).
Percentage of the users affect by the flag.
Default: 0

The percentage is compute by doing a hash of the user key (100000 variations), it means that you can have 3 numbers after the comma.
This is the query use to select on which user the flag should apply.
Rule format is describe in the rule format section.
If no rule set, the flag apply to all users (percentage still apply).
True if the flag is disabled.
Default: false
False if you don't want to export the data in your data exporter.
Default: true
rollout contains a specific rollout strategy you want to use.
See rollout section for more details.

Rule format

The rule format is based on the nikunjy/rules library.

All the operations can be written capitalized or lowercase (ex: eq or EQ can be used).
Logical Operations supported are AND OR.

Compare Expression and their definitions (a|b means you can use either one of the two a or b):

eq | ==equals to
ne | !=not equals to
lt | <less than
gt | >greater than
le | <=less than equal to
ge | >=greater than equal to
swstarts with
ewends with
inin a list
notnot of a logical expression


  • Select a specific user: key eq ""
  • Select all identified users: anonymous ne true
  • Select a user with a custom property: userId eq "12345"

Advanced configurations

You can have advanced configurations for your flag to have specific behavior for them, such as:

Get the latest GO Feature Flag updates