diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-01 18:06:00 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-01 18:06:00 +0000 |
commit | 77a73903aa803869d0ab7fe544cc2d8b1a6aa1e0 (patch) | |
tree | 0773f62090b7a896b29b8b08152565ba976716a8 /app/models/grafana_integration.rb | |
parent | ded8ee5a09a1a02209adf179ac7d6e456703726a (diff) | |
download | gitlab-ce-77a73903aa803869d0ab7fe544cc2d8b1a6aa1e0.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/grafana_integration.rb')
-rw-r--r-- | app/models/grafana_integration.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/grafana_integration.rb b/app/models/grafana_integration.rb index 51cc398394d..620bb4231a0 100644 --- a/app/models/grafana_integration.rb +++ b/app/models/grafana_integration.rb @@ -14,7 +14,11 @@ class GrafanaIntegration < ApplicationRecord validates :token, :project, presence: true + validates :enabled, inclusion: { in: [true, false] } + def client + return unless enabled? + @client ||= ::Grafana::Client.new(api_url: grafana_url.chomp('/'), token: token) end end |