Merge pull request #10668 from colinux/fix-flipper-strict
Tech: initialise vraiment les nouveaux feature flags
This commit is contained in:
commit
665289f7d0
2 changed files with 27 additions and 23 deletions
27
Gemfile.lock
27
Gemfile.lock
|
@ -174,7 +174,7 @@ GEM
|
||||||
clamav-client (3.2.0)
|
clamav-client (3.2.0)
|
||||||
coercible (1.0.0)
|
coercible (1.0.0)
|
||||||
descendants_tracker (~> 0.0.1)
|
descendants_tracker (~> 0.0.1)
|
||||||
concurrent-ruby (1.3.1)
|
concurrent-ruby (1.3.3)
|
||||||
connection_pool (2.4.1)
|
connection_pool (2.4.1)
|
||||||
content_disposition (1.0.0)
|
content_disposition (1.0.0)
|
||||||
crack (1.0.0)
|
crack (1.0.0)
|
||||||
|
@ -234,7 +234,7 @@ GEM
|
||||||
dumb_delegator (1.0.0)
|
dumb_delegator (1.0.0)
|
||||||
email_validator (2.2.4)
|
email_validator (2.2.4)
|
||||||
activemodel
|
activemodel
|
||||||
erubi (1.12.0)
|
erubi (1.13.0)
|
||||||
et-orbi (1.2.11)
|
et-orbi (1.2.11)
|
||||||
tzinfo
|
tzinfo
|
||||||
ethon (0.16.0)
|
ethon (0.16.0)
|
||||||
|
@ -252,19 +252,20 @@ GEM
|
||||||
faraday-net_http (3.1.0)
|
faraday-net_http (3.1.0)
|
||||||
net-http
|
net-http
|
||||||
ffi (1.16.3)
|
ffi (1.16.3)
|
||||||
flipper (1.2.2)
|
flipper (1.3.0)
|
||||||
concurrent-ruby (< 2)
|
concurrent-ruby (< 2)
|
||||||
flipper-active_record (1.2.2)
|
flipper-active_record (1.3.0)
|
||||||
activerecord (>= 4.2, < 8)
|
activerecord (>= 4.2, < 8)
|
||||||
flipper (~> 1.2.2)
|
flipper (~> 1.3.0)
|
||||||
flipper-active_support_cache_store (1.2.2)
|
flipper-active_support_cache_store (1.3.0)
|
||||||
activesupport (>= 4.2, < 8)
|
activesupport (>= 4.2, < 8)
|
||||||
flipper (~> 1.2.2)
|
flipper (~> 1.3.0)
|
||||||
flipper-ui (1.2.2)
|
flipper-ui (1.3.0)
|
||||||
erubi (>= 1.0.0, < 2.0.0)
|
erubi (>= 1.0.0, < 2.0.0)
|
||||||
flipper (~> 1.2.2)
|
flipper (~> 1.3.0)
|
||||||
rack (>= 1.4, < 4)
|
rack (>= 1.4, < 4)
|
||||||
rack-protection (>= 1.5.3, <= 4.0.0)
|
rack-protection (>= 1.5.3, < 5.0.0)
|
||||||
|
rack-session (>= 1.0.2, < 3.0.0)
|
||||||
sanitize (< 7)
|
sanitize (< 7)
|
||||||
fog-core (2.4.0)
|
fog-core (2.4.0)
|
||||||
builder
|
builder
|
||||||
|
@ -509,7 +510,7 @@ GEM
|
||||||
pundit (2.3.1)
|
pundit (2.3.1)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
raabro (1.4.0)
|
raabro (1.4.0)
|
||||||
racc (1.8.0)
|
racc (1.8.1)
|
||||||
rack (2.2.9)
|
rack (2.2.9)
|
||||||
rack-attack (6.7.0)
|
rack-attack (6.7.0)
|
||||||
rack (>= 1.0, < 4)
|
rack (>= 1.0, < 4)
|
||||||
|
@ -527,6 +528,8 @@ GEM
|
||||||
rack (~> 2.2, >= 2.2.4)
|
rack (~> 2.2, >= 2.2.4)
|
||||||
rack-proxy (0.7.7)
|
rack-proxy (0.7.7)
|
||||||
rack
|
rack
|
||||||
|
rack-session (1.0.2)
|
||||||
|
rack (< 3)
|
||||||
rack-test (2.1.0)
|
rack-test (2.1.0)
|
||||||
rack (>= 1.3)
|
rack (>= 1.3)
|
||||||
rack_session_access (0.2.0)
|
rack_session_access (0.2.0)
|
||||||
|
@ -677,7 +680,7 @@ GEM
|
||||||
nokogiri (>= 1.6.2)
|
nokogiri (>= 1.6.2)
|
||||||
rexml
|
rexml
|
||||||
xmlenc (>= 0.7.1)
|
xmlenc (>= 0.7.1)
|
||||||
sanitize (6.1.0)
|
sanitize (6.1.2)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.12.0)
|
nokogiri (>= 1.12.0)
|
||||||
sass (3.7.4)
|
sass (3.7.4)
|
||||||
|
|
|
@ -6,7 +6,7 @@ require 'flipper/adapters/active_record'
|
||||||
require 'flipper/adapters/active_support_cache_store'
|
require 'flipper/adapters/active_support_cache_store'
|
||||||
|
|
||||||
def setup_features(features)
|
def setup_features(features)
|
||||||
existing = Flipper.preload(features).map { _1.name.to_sym }
|
existing = Flipper.preload_all.map { _1.name.to_sym }
|
||||||
missing = features - existing
|
missing = features - existing
|
||||||
|
|
||||||
missing.each do |feature|
|
missing.each do |feature|
|
||||||
|
@ -41,23 +41,24 @@ rescue ActiveRecord::ConnectionNotEstablished, ActiveRecord::NoDatabaseError, PG
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Flipper.configure do |config|
|
||||||
|
config.adapter do
|
||||||
|
Flipper::Adapters::ActiveSupportCacheStore.new(
|
||||||
|
Flipper::Adapters::ActiveRecord.new,
|
||||||
|
ActiveSupport::Cache::MemoryStore.new,
|
||||||
|
10.seconds
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
ActiveSupport.on_load(:active_record) do
|
ActiveSupport.on_load(:active_record) do
|
||||||
if database_exists? && ActiveRecord::Base.connection.data_source_exists?('flipper_features')
|
if database_exists? && ActiveRecord::Base.connection.data_source_exists?('flipper_features')
|
||||||
setup_features(features)
|
setup_features(features)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Flipper.configure do |config|
|
|
||||||
config.adapter do
|
|
||||||
Flipper::Adapters::ActiveSupportCacheStore.new(
|
|
||||||
Flipper::Adapters::ActiveRecord.new,
|
|
||||||
ActiveSupport::Cache::MemoryStore.new,
|
|
||||||
expires_in: 10.seconds
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
Rails.application.configure do
|
Rails.application.configure do
|
||||||
|
config.flipper.actor_limit = 500 # default is 100 but hide_instructeur_email feature has ~478
|
||||||
# don't preload features for /assets/* but do for everything else
|
# don't preload features for /assets/* but do for everything else
|
||||||
config.flipper.preload = -> (request) { !request.path.start_with?('/assets/', '/ping') }
|
config.flipper.preload = -> (request) { !request.path.start_with?('/assets/', '/ping') }
|
||||||
config.flipper.strict = Rails.env.development?
|
config.flipper.strict = Rails.env.development?
|
||||||
|
|
Loading…
Reference in a new issue