summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-12-14 01:26:07 +0100
committerRémy Coutable <remy@rymai.me>2017-12-14 02:11:11 +0100
commitb51e6d6ddc7bf9ffdb9d82debfeaee4942e01659 (patch)
tree5582cf96be9b7d166d89a842125120b198687bab /config
parent54c2d7bdbddc18953571ed928948c18471d6edfa (diff)
downloadgitlab-ce-b51e6d6ddc7bf9ffdb9d82debfeaee4942e01659.tar.gz
Update flipper to 0.11.0 and take advantage of the new featuresrc/update-flipper
- 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>
Diffstat (limited to 'config')
-rw-r--r--config/initializers/flipper.rb24
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