The following SDK/versions support environments:
- js: v2.3.2+
- react: v0.1.0+
- ios: v1.1.0+
- statsig-node v3.2.0+
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".
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.