summaryrefslogtreecommitdiff
path: root/app/models/project_services
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-25 09:08:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-25 09:08:11 +0000
commit5064bf8c5647d4c4430cbb4d097cf1592416de29 (patch)
treed051bf2abe2cc7061b3a7facb6669a56ccb9cf54 /app/models/project_services
parent9c83aadd2604e7e6cb1f84683f951e6b12872618 (diff)
downloadgitlab-ce-5064bf8c5647d4c4430cbb4d097cf1592416de29.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/project_services')
-rw-r--r--app/models/project_services/prometheus_service.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/models/project_services/prometheus_service.rb b/app/models/project_services/prometheus_service.rb
index 75dfad4f3df..fd4ee069041 100644
--- a/app/models/project_services/prometheus_service.rb
+++ b/app/models/project_services/prometheus_service.rb
@@ -81,7 +81,7 @@ class PrometheusService < MonitoringService
def prometheus_client
return unless should_return_client?
- Gitlab::PrometheusClient.new(api_url)
+ Gitlab::PrometheusClient.new(api_url, allow_local_requests: allow_local_api_url?)
end
def prometheus_available?
@@ -94,7 +94,8 @@ class PrometheusService < MonitoringService
end
def allow_local_api_url?
- self_monitoring_project? && internal_prometheus_url?
+ allow_local_requests_from_web_hooks_and_services? ||
+ (self_monitoring_project? && internal_prometheus_url?)
end
def configured?
@@ -111,6 +112,10 @@ class PrometheusService < MonitoringService
api_url.present? && api_url == ::Gitlab::Prometheus::Internal.uri
end
+ def allow_local_requests_from_web_hooks_and_services?
+ current_settings.allow_local_requests_from_web_hooks_and_services?
+ end
+
def should_return_client?
api_url.present? && manual_configuration? && active? && valid?
end