DRY Flipper UI config

This commit is contained in:
Maikel Linke
2023-03-22 15:45:26 +11:00
parent fd68cbf56d
commit e0fd180edd

View File

@@ -2,13 +2,6 @@ require "flipper"
require "flipper/adapters/active_record"
require "open_food_network/feature_toggle"
if Rails.env.production?
Flipper::UI.configure do |config|
config.banner_text = '⚠️ Production environment: be aware that the changes have an impact on the application. Please, read the how-to before: https://github.com/openfoodfoundation/openfoodnetwork/wiki/Feature-toggle-with-Flipper'
config.banner_class = 'danger'
end
end
Flipper.register(:admins) { |actor| actor.respond_to?(:admin?) && actor.admin? }
Flipper::UI.configure do |config|
@@ -20,6 +13,15 @@ Flipper::UI.configure do |config|
# Defaults to false. Set to true to show feature descriptions on the list
# page as well as the view page.
# config.show_feature_description_in_list = true
if Rails.env.production?
config.banner_text = <<~TEXT
Production environment: be aware that the changes have an impact on the
application. Please read the how-to before:
https://github.com/openfoodfoundation/openfoodnetwork/wiki/Feature-toggle-with-Flipper
TEXT
config.banner_class = 'danger'
end
end
# Add known feature toggles. This may fail if the database isn't setup yet.