summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/concerns/requires_whitelisted_monitoring_client.rb6
-rw-r--r--config/initializers/1_settings.rb1
2 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/concerns/requires_whitelisted_monitoring_client.rb b/app/controllers/concerns/requires_whitelisted_monitoring_client.rb
index 25122ddbefa..1205dcb97c2 100644
--- a/app/controllers/concerns/requires_whitelisted_monitoring_client.rb
+++ b/app/controllers/concerns/requires_whitelisted_monitoring_client.rb
@@ -13,7 +13,11 @@ module RequiresWhitelistedMonitoringClient
def client_ip_whitelisted?
Settings.monitoring.ip_whitelist.any? { |e| e.include?(Gitlab::RequestContext.client_ip) }
end
-
+
+ def ip_whitelist
+ @ip_whitelist ||= Settings.monitoring.ip_whitelist.map(&IPAddr.method(:new))
+ end
+
def token_valid?
token = params[:token].presence || request.headers['TOKEN']
token.present? &&
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index 0c0dcd8413e..31c6bea9ed5 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -499,7 +499,6 @@ Settings.webpack.dev_server['port'] ||= 3808
#
Settings['monitoring'] ||= Settingslogic.new({})
Settings.monitoring['ip_whitelist'] ||= %w{127.0.0.1/8}
-Settings.monitoring.ip_whitelist.map!(&IPAddr.method(:new))
#
# Prometheus metrics settings