Feature Flags
Manage feature flags and service configurations across dev/staging/prod environments with conditional logic.
The Problem
Section titled “The Problem”Managing configs across environments means:
- Separate files — One config file per environment
- Duplication — Same structure repeated 3+ times
- Sync issues — Easy to miss updates in some environments
The JSSON Solution
Section titled “The JSSON Solution”featureFlags [template { feature, env, enabled }
map (flag) = { name = flag.feature environment = flag.env enabled = flag.enabled key = flag.feature + "_" + flag.env rolloutPercentage = flag.enabled == true ? 100 : 0 rolloutStrategy = "gradual"}
// New features - off in prod"new-dashboard", "prod", false"new-dashboard", "staging", true"new-dashboard", "dev", true
// Stable features - on everywhere"dark-mode", "prod", true"dark-mode", "staging", true"dark-mode", "dev", true]{"featureFlags": [ { "name": "new-dashboard", "environment": "prod", "enabled": false, "key": "new-dashboard_prod", "rolloutPercentage": 0, "rolloutStrategy": "gradual" }, { "name": "new-dashboard", "environment": "staging", "enabled": true, "key": "new-dashboard_staging", "rolloutPercentage": 100, "rolloutStrategy": "gradual" } // ... more flags]}Service Configuration
Section titled “Service Configuration”serviceConfig [template { service, env }
map (cfg) = { serviceName = cfg.service environment = cfg.env
// Database databaseHost = "db-" + cfg.env + ".internal" maxConnections = cfg.env == "prod" ? 100 : 20 sslEnabled = cfg.env == "prod" ? true : false
// Cache cacheHost = "redis-" + cfg.env + ".internal" cacheTTL = cfg.env == "prod" ? 3600 : 300
// Logging logLevel = cfg.env == "prod" ? "error" : "debug"}
"api", "prod""api", "staging""api", "dev"]Benefits
Section titled “Benefits”Single source — One file for all environments
Conditional logic — Different values per environment
Easy toggles — Change true to false
Consistency — Same structure everywhere
When to Use
Section titled “When to Use”Perfect for:
- Feature flag management
- Environment-specific configs
- A/B testing setups
- Rollout strategies
Try It!
Section titled “Try It!”- Save to
feature-flags.jsson - Run:
jsson -i feature-flags.jsson - Manage your features!
What’s Next?
Section titled “What’s Next?”- Kubernetes — Multi-env deployments
- Overview — All examples
Toggle features with confidence! 🚀