All of our SDKs allow you to set the environment tier your app is currently in during initialization. If you'd like to evaluate feature gates, dynamic configs, and/or experiments to different values in development/staging environment vs. production, you simply need to set the correct environment in your code when initializing and configure the corresponding features in Statsig console to evaluate differently for an environment tier. The sections below goes into details on how to do these.
When initializing the SDK, set the environment via the
StatsigOptions parameter. All SDKs accept an SDK key and an (optional)
StatsigOptions dictionary of parameters.
One of those options is the
environment parameter, which has a
tier field. The
tier can be one of: "production"/"development"/"staging". If the environment tier is unset, all checks and event logs are considered "production" data.
For this example, lets say we are setting the parameter for our development environment/app.
Client SDKs take an SDK Key, User, and StatsigOptions parameter:
Server SDKs take just an SDK Key and StatsigOptions parameter:
These examples in js and node illustrate the general pattern - refer to your language's specific SDK documentation for more information.
Head on over to the console and create a new feature gate. For this example, I'll call mine "development mode." It will only pass for our development apps.
Then, add a rule with an "Environment Tier" condition:
And select the "development" option:
Your rules should look something like this - don't forget to click "Save Changes" to finalize them!
Now you have created a gate which will pass for all users who are using one of your "development" builds.