Adapters
Flipper is built on adapters for maximum flexibility. Regardless of what data store you are using, Flipper can performantly store data in it.
Storage adapters are local to your application, so you'll always have blazing fast feature checks that are always in sync and available—even if Flipper Cloud isn't for some reason.
Officially Supported
Pick one of our supported adapters and follow the installation instructions:
Storage
You definitely need one of these.
|
|
---|---|
ActiveRecord | Production Rails apps |
Moneta | Production Ruby apps already using Moneta |
Mongo | Production Ruby apps already using Mongo |
Redis | Production Ruby apps already using Redis |
Sequel | Production Ruby apps already using Sequel |
Cache
Reduce calls to storage to speed things up.
|
|
ActiveSupportCacheStore | Production Rails apps with aggressive caching needs |
Dalli | Production Ruby apps already using Dalli |
Redis Cache | Production Rails apps with aggressive caching needs |
Extras
Additional functionality to complement primary adapters.
|
|
ActorLimit | Limits the number of actors that can be enabled for a feature (default: 100) |
Failover | Increasing reliability by failing over to a secondary adapter if primary is unavailable |
Failsafe | Graceful failures when an exception is raised |
Instrumented | Instrumenting all adapter operations with ActiveSupport::Notifications |
Read Only | Preventing writes from a Production console |
Strict | Raising an error if an unrecognized flag is used |
Internal
You probably dont need these but here they are.
|
|
Dual Write | Read from one adapter but write to two (used by Cloud) |
Memoizable | Prevent subsquent calls to an adapter for the same feature (used by memoizing middleware) |
Memory | Testing Environments |
Operation Logger | Stores all adapter operations in memory for verification in tests |
Poll | Polls for changes from a remote adapter in a background thread but updates local adapter in main thread (used by Cloud) |
Sync | Keeping two adapters in sync (bits are used in Cloud) |
Niche
Highly specialized adapters outside of day-to-day usage.
|
|
HTTP | Connecting to Flipper::Api |
PStore | When a local file is enough or you need something that works with multiple processes like some system tests |
Rollout | Migrating from Rollout to Flipper |
JavaScript in Rails
In addition to the standard adapters, we wrote a blog post about client-side flags with recommendations and examples of how to expose feature flags to client-side code in Rails apps.'
Create a new adapter
Don't see an adapter that suits your needs? You can create your own. We even provide automatic (rspec and minitest) tests for you, so you know you've built your custom adapter correctly.
Swapping Adapters
If you find yourself using one adapter and would like to swap to another, you can do that! Flipper adapters support importing another adapter's data. This will wipe the adapter you are wanting to swap to, if it isn't already clean, so please be careful.
# Say you are using redis...
redis_adapter = Flipper::Adapters::Redis.new(Redis.new)
redis_flipper = Flipper.new(redis_adapter)
# And redis has some stuff enabled...
redis_flipper.enable(:search)
redis_flipper.enable_percentage_of_time(:verbose_logging, 5)
redis_flipper.enable_percentage_of_actors(:new_feature, 5)
redis_flipper.enable_actor(:issues, Flipper::Actor.new('1'))
redis_flipper.enable_actor(:issues, Flipper::Actor.new('2'))
redis_flipper.enable_group(:request_tracing, :staff)
# And you would like to switch to active record...
ar_adapter = Flipper::Adapters::ActiveRecord.new
ar_flipper = Flipper.new(ar_adapter)
# NOTE: This wipes active record clean and copies features/gates from redis into active record.
ar_flipper.import(redis_flipper)
# active record is now identical to redis.
ar_flipper.features.each do |feature|
pp feature: feature.key, values: feature.gate_values
end
Get audit history, rollbacks, advanced permissions, analytics, and all of your projects in one place.
You can choose from several tiers to sponsor Flipper on GitHub and get some great benefits!