From 1c53bbec57d8cef89fb75769677039918a7fcbfe Mon Sep 17 00:00:00 2001 From: jibees Date: Mon, 19 Apr 2021 17:03:49 +0200 Subject: [PATCH] Add banner to Flipper UI to warn the admin users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a link (escaped...) to the wiki page Co-authored-by: Pau Pérez Fabregat --- config/initializers/flipper.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/initializers/flipper.rb b/config/initializers/flipper.rb index 96e1ce03eb..ba248612bf 100644 --- a/config/initializers/flipper.rb +++ b/config/initializers/flipper.rb @@ -6,6 +6,14 @@ Flipper.configure do |config| Flipper.new(Flipper::Adapters::ActiveRecord.new) end end + +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 + Rails.configuration.middleware.use Flipper::Middleware::Memoizer, preload_all: true Flipper.register(:admins) { |actor| actor.respond_to?(:admin?) && actor.admin? }