Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read datadog_host cap variable for specifying Datadog API endpoint #255

Merged
merged 3 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/capistrano/datadog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ def self.cap_version()
@cap_version
end

def self.submit(api_key, use_getlogin=true)
def self.submit(api_key, use_getlogin=true, endpoint=nil)
begin
if api_key
dog = Dogapi::Client.new(api_key)
dog = Dogapi::Client.new(api_key, nil, nil, nil, true, nil, endpoint, false)
reporter.report(use_getlogin).each do |event, hosts|
if hosts.size > 0
hosts.each do |host|
Expand Down
4 changes: 2 additions & 2 deletions lib/capistrano/datadog/v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def puts(message)
desc 'Submit the tasks that have run to Datadog as events'
task :submit do |ns|
if variables[:use_getlogin].nil?
Capistrano::Datadog.submit variables[:datadog_api_key]
Capistrano::Datadog.submit variables[:datadog_api_key], true, variables[:datadog_host]
else
Capistrano::Datadog.submit variables[:datadog_api_key], variables[:use_getlogin]
Capistrano::Datadog.submit variables[:datadog_api_key], variables[:use_getlogin], variables[:datadog_host]
end
end
end
Expand Down
5 changes: 3 additions & 2 deletions lib/capistrano/datadog/v3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ def initialize(oio)
at_exit do
api_key = Capistrano::Configuration.env.fetch :datadog_api_key
use_getlogin = Capistrano::Configuration.env.fetch :use_getlogin
datadog_host = Capistrano::Configuration.env.fetch :datadog_host
if use_getlogin.nil?
Capistrano::Datadog.submit api_key
Capistrano::Datadog.submit api_key, true, datadog_host
else
Capistrano::Datadog.submit api_key, use_getlogin
Capistrano::Datadog.submit api_key, use_getlogin, datadog_host
end
end