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

Add support for 'site' option. #582

Merged
merged 9 commits into from
Apr 26, 2019
Prev Previous commit
Next Next commit
Also use the node run_state to store dd_url value.
  • Loading branch information
remeh committed Feb 20, 2019
commit 75d9adc1440b62938f58e0b4627f18488c38b17e
10 changes: 5 additions & 5 deletions recipes/dd-agent.rb
Original file line number Diff line number Diff line change
@@ -40,12 +40,12 @@
agent_start = node['datadog']['agent_start'] ? :start : :stop

# use either the site option or the url one, the latter having priority.
dd_url = 'https://app.datadoghq.com'
node.run_state['dd_url'] = 'https://app.datadoghq.com'
if node['datadog']['site']
dd_url = 'https://app.' + node['datadog']['site']
node.run_state['dd_url'] = 'https://app.' + node['datadog']['site']
end
if node['datadog']['url']
dd_url = node['datadog']['url']
node.run_state['dd_url'] = node['datadog']['url']
end

#
@@ -75,14 +75,14 @@
template agent_config_file do
def template_vars
api_keys = [Chef::Datadog.api_key(node)]
dd_urls = [dd_url]
dd_urls = [node.run_state['dd_url']]
node['datadog']['extra_endpoints'].each do |_, endpoint|
next unless endpoint['enabled']
api_keys << endpoint['api_key']
dd_urls << if endpoint['url']
endpoint['url']
else
dd_url
node.run_state['dd_url']
end
end
{