gitlab-org--gitlab-foss/config/initializers/flipper.rb
Rémy Coutable b51e6d6ddc
Update flipper to 0.11.0 and take advantage of the new features
- Added an ActiveSupport (using Rails.cache) caching adapter
- Overview of the new features can be found at https://johnnunemaker.com/flippin-features-at-runtime/
- Full Changelog can be found at https://github.com/jnunemaker/flipper/blob/v0.11.0/Changelog.md

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-12-14 02:11:11 +01:00

22 lines
626 B
Ruby

require 'flipper/adapters/active_record'
require 'flipper/adapters/active_support_cache_store'
Flipper.configure do |config|
config.default do
adapter = Flipper::Adapters::ActiveRecord.new(
feature_class: Feature::FlipperFeature, gate_class: Feature::FlipperGate)
cached_adapter = Flipper::Adapters::ActiveSupportCacheStore.new(
adapter,
Rails.cache,
expires_in: 10.seconds)
Flipper.new(cached_adapter)
end
end
Feature.register_feature_groups
unless Rails.env.test?
require 'flipper/middleware/memoizer'
Rails.application.config.middleware.use Flipper::Middleware::Memoizer
end