To schedule a feature gate roll out based on the environment in Statsig, you need to specify the environment during initialization and in your feature gate rules.
During initialization, set the environment tier as follows:
javascript options = { environment: { tier: `${env}` }, }
After setting the environment tier, you need to specify the environment in your feature gate rules. Follow these steps:
1. Navigate to the Statsig Console and create or edit a Feature Gate.
2. When creating a rule for your Feature Gate, check the "Specify Environments" checkbox.
3. Choose the environments (like 'development' or 'staging') you want your rule to be enabled for.
4. Save your changes.
By default, unless otherwise specified, a rule is enabled for ALL environments. Therefore, it's crucial to specify the environment in your feature gate rules.
If your feature gate is not evaluating as expected, double-check the environment value you're passing during initialization. Ensure it matches exactly with the environment specified in your feature gate rules.
Remember, the order of rules in the Statsig console matters. If you have multiple rules, the first rule that matches the conditions will be applied. Therefore, if you have a specific rule for a certain environment, make sure it is placed before any general rules that could also apply.