summaryrefslogtreecommitdiff
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2019-09-02 14:55:56 +0700
committerShinya Maeda <shinya@gitlab.com>2019-09-02 16:01:30 +0700
commitf8e3f088ab18df3093239be82fa01deb03161e20 (patch)
tree07d389b4c0c6f4a4f122a420b4ca77cd1d65dc32 /app/controllers/application_controller.rb
parent12834544776a1888db3a5d0780bdc3aa0d94e7d6 (diff)
downloadgitlab-ce-implement-unleash-client.tar.gz
Generalize Feature Flag system and implement unleash adapterimplement-unleash-client
This commit abstracts the current Feature implementation and make it adoptable with any feature flag systems.
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 9a7859fc687..5af62576299 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -26,6 +26,7 @@ class ApplicationController < ActionController::Base
before_action :require_email, unless: :devise_controller?
before_action :set_usage_stats_consent_flag
before_action :check_impersonation_availability
+ before_action :set_unleash_context
around_action :set_locale
around_action :set_session_storage
@@ -533,6 +534,16 @@ class ApplicationController < ActionController::Base
yield
end
end
+
+ private
+
+ def set_unleash_context
+ @unleash_context = Unleash::Context.new(
+ session_id: session.id,
+ remote_address: request.remote_ip,
+ user_id: session[:user_id]
+ )
+ end
end
ApplicationController.prepend_if_ee('EE::ApplicationController')