Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Statsig: Change default value for a Feature Gate

How to give default values so that for whatever reason the the initialization fails, We can fallback to the default. I understand that it will default to false currently, right? If i want a feature to be true. How can i do that?

if (!useGate('my_killswitch')) { 
  showFeature(); 
}
like image 999
Statsig Community Avatar asked Nov 27 '25 14:11

Statsig Community


1 Answers

Feature Gates are always boolean with the default value as false. If you want Feature Gates to work as a negative gate, then you can use the inverse in code.

For instance, instead of naming your gate, launch_cool_new_feature, you could name the gate, block_cool_new_feature and in code, you'd do something like this:

if (statsig.checkGate('block_cool_new_feature')) {
  // Don't show new feature
} else {
  // Show cool new feature
}
like image 65
slacker Avatar answered Nov 30 '25 02:11

slacker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!