Learn how to manage feature flags across different environments in your application.
Environments in MyFlags allow you to manage feature flags differently across your development, staging, and production environments. This ensures safe testing and controlled rollouts.
MyFlags comes with three default environments:
For local development and testing
For pre-production testing and validation
For your live application
Each environment can be configured with:
Here's how to initialize the SDK with different environments:
// Initialize with development environment import { MyFlagsSDK } from "@myflags/core"; const sdk = new MyFlagsSDK({ apiKey: 'dev-api-key', projectId: 'your-project-id', environment: 'development' }); // Initialize with production environment const sdk = new MyFlagsSDK({ apiKey: 'prod-api-key', projectId: 'your-project-id', environment: 'production' });
The environment setting ensures you're using the correct feature flag values for your current environment.