debian-mirror-gitlab/config/initializers/flipper.rb

23 lines
622 B
Ruby
Raw Normal View History

2018-03-17 18:26:18 +05:30
require 'flipper/adapters/active_record'
require 'flipper/adapters/active_support_cache_store'
2017-09-10 17:25:29 +05:30
2018-03-17 18:26:18 +05:30
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: 1.hour)
Flipper.new(cached_adapter)
end
end
2017-09-10 17:25:29 +05:30
2018-03-17 18:26:18 +05:30
Feature.register_feature_groups
unless Rails.env.test?
require 'flipper/middleware/memoizer'
Rails.application.config.middleware.use Flipper::Middleware::Memoizer
2017-09-10 17:25:29 +05:30
end