Commit de6c3597 authored by Pawel Chojnacki's avatar Pawel Chojnacki

correctly handle transforming settings into useful datastructure

parent c1b043bd
...@@ -13,7 +13,11 @@ module RequiresWhitelistedMonitoringClient ...@@ -13,7 +13,11 @@ module RequiresWhitelistedMonitoringClient
def client_ip_whitelisted? def client_ip_whitelisted?
Settings.monitoring.ip_whitelist.any? { |e| e.include?(Gitlab::RequestContext.client_ip) } Settings.monitoring.ip_whitelist.any? { |e| e.include?(Gitlab::RequestContext.client_ip) }
end end
def ip_whitelist
@ip_whitelist ||= Settings.monitoring.ip_whitelist.map(&IPAddr.method(:new))
end
def token_valid? def token_valid?
token = params[:token].presence || request.headers['TOKEN'] token = params[:token].presence || request.headers['TOKEN']
token.present? && token.present? &&
......
...@@ -499,7 +499,6 @@ Settings.webpack.dev_server['port'] ||= 3808 ...@@ -499,7 +499,6 @@ Settings.webpack.dev_server['port'] ||= 3808
# #
Settings['monitoring'] ||= Settingslogic.new({}) Settings['monitoring'] ||= Settingslogic.new({})
Settings.monitoring['ip_whitelist'] ||= %w{127.0.0.1/8} Settings.monitoring['ip_whitelist'] ||= %w{127.0.0.1/8}
Settings.monitoring.ip_whitelist.map!(&IPAddr.method(:new))
# #
# Prometheus metrics settings # Prometheus metrics settings
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment