Commit a8f2e659 authored by Robert Speicher's avatar Robert Speicher

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
parents 26484cf1 b51e6d6d
...@@ -405,8 +405,9 @@ gem 'gitaly-proto', '~> 0.59.0', require: 'gitaly' ...@@ -405,8 +405,9 @@ gem 'gitaly-proto', '~> 0.59.0', require: 'gitaly'
gem 'toml-rb', '~> 0.3.15', require: false gem 'toml-rb', '~> 0.3.15', require: false
# Feature toggles # Feature toggles
gem 'flipper', '~> 0.10.2' gem 'flipper', '~> 0.11.0'
gem 'flipper-active_record', '~> 0.10.2' gem 'flipper-active_record', '~> 0.11.0'
gem 'flipper-active_support_cache_store', '~> 0.11.0'
# Structured logging # Structured logging
gem 'lograge', '~> 0.5' gem 'lograge', '~> 0.5'
......
...@@ -215,10 +215,13 @@ GEM ...@@ -215,10 +215,13 @@ GEM
path_expander (~> 1.0) path_expander (~> 1.0)
ruby_parser (~> 3.0) ruby_parser (~> 3.0)
sexp_processor (~> 4.0) sexp_processor (~> 4.0)
flipper (0.10.2) flipper (0.11.0)
flipper-active_record (0.10.2) flipper-active_record (0.11.0)
activerecord (>= 3.2, < 6) activerecord (>= 3.2, < 6)
flipper (~> 0.10.2) flipper (~> 0.11.0)
flipper-active_support_cache_store (0.11.0)
activesupport (>= 3.2, < 6)
flipper (~> 0.11.0)
flowdock (0.7.1) flowdock (0.7.1)
httparty (~> 0.7) httparty (~> 0.7)
multi_json multi_json
...@@ -1021,8 +1024,9 @@ DEPENDENCIES ...@@ -1021,8 +1024,9 @@ DEPENDENCIES
faraday (~> 0.12) faraday (~> 0.12)
ffaker (~> 2.4) ffaker (~> 2.4)
flay (~> 2.8.0) flay (~> 2.8.0)
flipper (~> 0.10.2) flipper (~> 0.11.0)
flipper-active_record (~> 0.10.2) flipper-active_record (~> 0.11.0)
flipper-active_support_cache_store (~> 0.11.0)
fog-aliyun (~> 0.2.0) fog-aliyun (~> 0.2.0)
fog-aws (~> 1.4) fog-aws (~> 1.4)
fog-core (~> 1.44) fog-core (~> 1.44)
......
require 'flipper/middleware/memoizer' require 'flipper/adapters/active_record'
require 'flipper/adapters/active_support_cache_store'
unless Rails.env.test? Flipper.configure do |config|
Rails.application.config.middleware.use Flipper::Middleware::Memoizer, config.default do
lambda { Feature.flipper } 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 end
require 'flipper/adapters/active_record'
class Feature class Feature
# Classes to override flipper table names # Classes to override flipper table names
class FlipperFeature < Flipper::Adapters::ActiveRecord::Feature class FlipperFeature < Flipper::Adapters::ActiveRecord::Feature
...@@ -62,12 +60,7 @@ class Feature ...@@ -62,12 +60,7 @@ class Feature
end end
def flipper def flipper
@flipper ||= begin @flipper ||= Flipper.instance
adapter = Flipper::Adapters::ActiveRecord.new(
feature_class: FlipperFeature, gate_class: FlipperGate)
Flipper.new(adapter)
end
end end
# This method is called from config/initializers/flipper.rb and can be used # This method is called from config/initializers/flipper.rb and can be used
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment