Environments
Environments allow you to manage feature flags separately for development, staging, and production.
How Environments Work
Each environment in Flagstack has its own set of feature flag states. This means you can:
- Enable a feature in development while keeping it off in production
- Test features in staging before rolling out to production
- Use different targeting rules per environment
Default Environments
When you create an organization, Flagstack creates three default environments:
Production
Your live environment serving real users.
Staging
Pre-production environment for final testing.
Development
Local development and testing.
Personal Environments
Team members can create personal environments for individual development. These are only visible to the user who created them.
Environment Tokens
Each environment has its own API token. Use the correct token to fetch flag states for that environment:
# Token determines which environment's flags are synced
# fs_live_* = production, fs_test_* = staging, fs_dev_* = development
Flagstack.configure do |config|
config.token = ENV["FLAGSTACK_TOKEN"]
end
Important
Never use a production token in development, or vice versa. This could cause features to be enabled or disabled unexpectedly.