Commit eea0e99d authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'remove-unused-geo-base-notifier-class' into 'master'

Remove unused Geo::BaseNotify class

See merge request gitlab-org/gitlab!61275
parents 025c8197 7fae8067
# frozen_string_literal: true
module Geo
class BaseNotify
def notify(notify_url, content)
response = Gitlab::HTTP.post(notify_url,
timeout: Gitlab.config.gitlab.webhook_timeout,
body: content,
allow_local_requests: true,
headers: {
'Content-Type' => 'application/json',
'PRIVATE-TOKEN' => private_token
})
[(response.code >= 200 && response.code < 300), ActionView::Base.full_sanitizer.sanitize(response.to_s)]
rescue Gitlab::HTTP::Error, Errno::ECONNREFUSED => e
[false, ActionView::Base.full_sanitizer.sanitize(e.message)]
end
private
# rubocop: disable CodeReuse/ActiveRecord
def private_token
# TODO: should we ask admin user to be defined as part of configuration?
@private_token ||= User.find_by(admin: true).authentication_token
end
# rubocop: enable CodeReuse/ActiveRecord
end
end
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