Environments
Environments scope your flag and segment configuration, so the same flag can behave differently depending on which environment evaluates it. Every project starts with a production environment.
How environments work
Section titled “How environments work”Each feature flag holds per-environment configuration: whether it’s enabled or off, its fallthrough value, and its targeting rules. That config lives independently in each environment.
Each environment compiles to its own payload, so evaluating a flag in production reads the production config and evaluating it in another environment reads that environment’s config. Changing a flag in one environment doesn’t touch the others.
Creating a custom environment
Section titled “Creating a custom environment”Create environments with the REST API:
curl -X POST https://statskit.ai/api/v1/environments \ -H "Authorization: Bearer vsk_live_…" \ -H "Content-Type: application/json" \ -d '{"key": "staging", "name": "Staging"}'See Segments for the related targeting API.
When to use staging vs production
Section titled “When to use staging vs production”Add a staging environment when you want to configure and test flag behavior without affecting live traffic:
- Test targeting rules against a staging build before turning them on in production.
- Enable a flag early for your team in staging while it stays off in production.
- Keep experiments contained so a change to staging config never rolls out to real users.