diff options
author | Robert Speicher <robert@gitlab.com> | 2017-12-14 17:56:24 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-12-14 17:56:24 +0000 |
commit | a8f2e659ece8b161d6ea9774493de000f80353b2 (patch) | |
tree | e564e6e3f94ea3f6ef5d00bed1e64cae22b17540 /config/initializers | |
parent | 26484cf125c49465ba32c9a95f9655c4e4a8fbdf (diff) | |
parent | b51e6d6ddc7bf9ffdb9d82debfeaee4942e01659 (diff) | |
download | gitlab-ce-a8f2e659ece8b161d6ea9774493de000f80353b2.tar.gz |
Merge branch 'rc/update-flipper' into 'master'
Update flipper to 0.11.0 and take advantage of the new features
See merge request gitlab-org/gitlab-ce!15920
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/flipper.rb | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/config/initializers/flipper.rb b/config/initializers/flipper.rb index bfab8c77a4b..cc9167d29b9 100644 --- a/config/initializers/flipper.rb +++ b/config/initializers/flipper.rb @@ -1,8 +1,22 @@ -require 'flipper/middleware/memoizer' +require 'flipper/adapters/active_record' +require 'flipper/adapters/active_support_cache_store' -unless Rails.env.test? - Rails.application.config.middleware.use Flipper::Middleware::Memoizer, - lambda { Feature.flipper } +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 +Feature.register_feature_groups + +unless Rails.env.test? + require 'flipper/middleware/memoizer' + Rails.application.config.middleware.use Flipper::Middleware::Memoizer end |