What are environments
Each project in CanaryGate has independent environments. A flag with the same name can have completely different states in each environment — so you can test in staging before activating in production.
By default, each project has:
productionstaging
How it works
Each environment has its own API Key. When initializing the SDK, you implicitly specify the environment by the key you use:
// Production SDK
const canary = new CanaryGate(process.env.CANARYGATE_PRODUCTION_KEY!)
// Staging SDK
const canary = new CanaryGate(process.env.CANARYGATE_STAGING_KEY!)State isolation
Activating a flag in staging does not affect production. Each environment has:
- Its own flag state (enabled/disabled, percentage)
- Separate audit history
- Webhooks configured independently
Best practices
- Always test flag changes in
stagingbefore activating inproduction - Use environment-specific variable names in
.env(e.g.CANARYGATE_PRODUCTION_KEY,CANARYGATE_STAGING_KEY) - Avoid manually syncing flag states between environments — treat each environment independently
Last updated on